Skip to content

Commit

Permalink
FsZip: do not attempt to open folder 'foo.zip' as an archive
Browse files Browse the repository at this point in the history
  • Loading branch information
warpdesign committed Mar 9, 2023
1 parent 644fa21 commit 44918e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/services/plugins/FsLocal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export class LocalApi implements FsApi {

export function FolderExists(path: string): boolean {
try {
return fs.existsSync(path) && fs.lstatSync(path).isDirectory()
return fs.existsSync(path) && fs.statSync(path).isDirectory()
} catch (err) {
return false
}
Expand All @@ -501,8 +501,9 @@ export const FsLocal: Fs = {
readonly: false,
indirect: false,
},
canread(basePath: string): boolean {
return !!basePath.match(localStart)
canread(basePath: string, subDir: string): boolean {
const fullPath = path.join(basePath, subDir)
return !!basePath.match(localStart) && FolderExists(fullPath)
},
serverpart(str: string): string {
return 'local'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/initFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function initFS() {
} else {
// TODO: there should be an easy way to automatically register new FS
registerFs(FsWsl)
registerFs(FsZip)
registerFs(FsLocal)
registerFs(FsZip)
}
}

0 comments on commit 44918e7

Please sign in to comment.