Skip to content

Commit edc098e

Browse files
committed
fix: feedback
1 parent 24fdc54 commit edc098e

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

packages/astro/src/default/utils/url.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export function joinPaths(baseURL: string, ...paths: string[]): string {
2-
let result = baseURL || '/';
1+
export function joinPaths(basePath: string, ...paths: string[]): string {
2+
let result = basePath || '/';
33

44
for (const subpath of paths) {
55
if (subpath.length === 0) {

packages/runtime/src/lesson-files.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('LessonFilesFetcher', () => {
3838
test('getLessonTemplate should fetch at a different pathname if the fetcher is configured to use a different base', async () => {
3939
fetchBody = { 'a.txt': 'content' };
4040

41-
const fetcher = new LessonFilesFetcher('/foo/');
41+
const fetcher = new LessonFilesFetcher('/foo');
4242
const files = await fetcher.getLessonTemplate({ data: { template: 'default' } } as any);
4343

4444
expect(files).toEqual({ 'a.txt': 'content' });

packages/runtime/src/lesson-files.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ export class LessonFilesFetcher {
1414
private _templateLoadTask?: Task<Files>;
1515
private _templateLoaded: string | undefined;
1616

17-
/**
18-
* Create a new instance of the LessonFilesFetcher.
19-
*
20-
* This class is responsible for fetching lesson files and templates.
21-
* It caches the files in memory to avoid fetching them multiple times.
22-
*
23-
* @param _basePathname The base pathname to use when fetching files.
24-
*/
25-
constructor(private _basePathname: string = '/') {}
17+
constructor(private _basePathname: string = '/') {
18+
if (!this._basePathname.endsWith('/')) {
19+
this._basePathname = this._basePathname + '/';
20+
}
21+
}
2622

2723
async invalidate(filesRef: string): Promise<InvalidationResult> {
2824
if (!this._map.has(filesRef)) {

0 commit comments

Comments
 (0)