This repository was archived by the owner on Oct 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,11 @@ export class LocalFileSystem implements FileSystem {
78
78
follow : true ,
79
79
} )
80
80
globber . on ( 'match' , ( file : string ) => {
81
- subscriber . next ( normalizeUri ( base + file ) )
81
+ const encodedPath = file
82
+ . split ( '/' )
83
+ . map ( encodeURIComponent )
84
+ . join ( '/' )
85
+ subscriber . next ( normalizeUri ( base + encodedPath ) )
82
86
} )
83
87
globber . on ( 'error' , ( err : any ) => {
84
88
subscriber . error ( err )
Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ describe('memfs.ts', () => {
18
18
sinon . assert . calledOnce ( listener )
19
19
sinon . assert . calledWithExactly ( listener , 'file:///foo/bar.txt' , undefined )
20
20
} )
21
+ it ( 'should add just a URI and emit an event when URI has encoded char' , ( ) => {
22
+ const listener = sinon . spy ( )
23
+ const fs = new InMemoryFileSystem ( '/' )
24
+ fs . on ( 'add' , listener )
25
+ fs . add ( 'file:///foo/%25bar.txt' )
26
+ sinon . assert . calledOnce ( listener )
27
+ sinon . assert . calledWithExactly ( listener , 'file:///foo/%25bar.txt' , undefined )
28
+ } )
21
29
it ( 'should add content for a URI and emit an event' , ( ) => {
22
30
const listener = sinon . spy ( )
23
31
const fs = new InMemoryFileSystem ( '/' )
You can’t perform that action at this time.
0 commit comments