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 +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ 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
+ subscriber . next ( file )
82
82
} )
83
83
globber . on ( 'error' , ( err : any ) => {
84
84
subscriber . error ( err )
@@ -89,6 +89,12 @@ export class LocalFileSystem implements FileSystem {
89
89
return ( ) => {
90
90
globber . abort ( )
91
91
}
92
+ } ) . map ( file => {
93
+ const encodedPath = file
94
+ . split ( '/' )
95
+ . map ( encodeURIComponent )
96
+ . join ( '/' )
97
+ return normalizeUri ( base + encodedPath )
92
98
} )
93
99
}
94
100
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