Skip to content

Commit 728221d

Browse files
committed
FsZip: do not attempt to open folder 'foo.zip' as an archive
1 parent 36edb3b commit 728221d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/services/plugins/FsLocal.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ export class LocalApi implements FsApi {
486486

487487
export function FolderExists(path: string): boolean {
488488
try {
489-
return fs.existsSync(path) && fs.lstatSync(path).isDirectory()
489+
return fs.existsSync(path) && fs.statSync(path).isDirectory()
490490
} catch (err) {
491491
return false
492492
}
@@ -501,8 +501,9 @@ export const FsLocal: Fs = {
501501
readonly: false,
502502
indirect: false,
503503
},
504-
canread(basePath: string): boolean {
505-
return !!basePath.match(localStart)
504+
canread(basePath: string, subDir: string): boolean {
505+
const fullPath = path.join(basePath, subDir)
506+
return !!basePath.match(localStart) && FolderExists(fullPath)
506507
},
507508
serverpart(str: string): string {
508509
return 'local'

src/utils/initFS.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function initFS() {
1414
} else {
1515
// TODO: there should be an easy way to automatically register new FS
1616
registerFs(FsWsl)
17-
registerFs(FsZip)
1817
registerFs(FsLocal)
18+
registerFs(FsZip)
1919
}
2020
}

0 commit comments

Comments
 (0)