File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 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 || '/' ;
3
3
4
4
for ( const subpath of paths ) {
5
5
if ( subpath . length === 0 ) {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ describe('LessonFilesFetcher', () => {
38
38
test ( 'getLessonTemplate should fetch at a different pathname if the fetcher is configured to use a different base' , async ( ) => {
39
39
fetchBody = { 'a.txt' : 'content' } ;
40
40
41
- const fetcher = new LessonFilesFetcher ( '/foo/ ' ) ;
41
+ const fetcher = new LessonFilesFetcher ( '/foo' ) ;
42
42
const files = await fetcher . getLessonTemplate ( { data : { template : 'default' } } as any ) ;
43
43
44
44
expect ( files ) . toEqual ( { 'a.txt' : 'content' } ) ;
Original file line number Diff line number Diff line change @@ -14,15 +14,11 @@ export class LessonFilesFetcher {
14
14
private _templateLoadTask ?: Task < Files > ;
15
15
private _templateLoaded : string | undefined ;
16
16
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
+ }
26
22
27
23
async invalidate ( filesRef : string ) : Promise < InvalidationResult > {
28
24
if ( ! this . _map . has ( filesRef ) ) {
You can’t perform that action at this time.
0 commit comments