File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -28,14 +28,13 @@ export async function openFileSystem(basePath: string | Uint8Array): Promise<Fil
28
28
// absolute path convert to relative path
29
29
e . fileName = fileName . replace ( / ^ [ a - z A - Z ] : / , '' ) . replace ( / ^ \/ / , '' )
30
30
}
31
- if ( fileName . split ( "/" ) . indexOf ( ".." ) !== - 1 ) {
32
- return "invalid relative path: " + fileName ;
33
- }
34
- // all good
35
31
return null ;
36
32
} ,
37
33
} )
38
- const entries = await readAllEntries ( zip )
34
+ const entries = await readAllEntries ( zip ) . then ( es =>
35
+ // ignore entries with '..' in the path
36
+ es . filter ( e => e . fileName . split ( "/" ) . indexOf ( ".." ) === - 1 )
37
+ )
39
38
const entriesRecord : Record < string , Entry > = { }
40
39
for ( const entry of entries ) {
41
40
entriesRecord [ entry . fileName ] = entry
You can’t perform that action at this time.
0 commit comments