diff --git a/websocketfs/lib/metadata-file.ts b/websocketfs/lib/metadata-file.ts index 13997bd..185f10f 100644 --- a/websocketfs/lib/metadata-file.ts +++ b/websocketfs/lib/metadata-file.ts @@ -117,7 +117,10 @@ export class MetadataFile { }; private cacheAttrs = (i: number) => { - const v = this.metadataFileContents[i].split("\0"); + const v = this.metadataFileContents[i]?.split("\0"); + if (v == null || v.length <= 1) { + return { errno: -2 }; + } const data = v[1].split(" "); const mtime = new Date(parseFloat(data[0]) * 1000); const attr = { diff --git a/websocketfs/lib/sftp-fuse.ts b/websocketfs/lib/sftp-fuse.ts index 55ec5e9..02cdaeb 100644 --- a/websocketfs/lib/sftp-fuse.ts +++ b/websocketfs/lib/sftp-fuse.ts @@ -267,7 +267,7 @@ export default class SftpFuse { cb(errno ?? 0, attr); return; } - if (this.meta?.isReady()) { + if (!path.startsWith("/.") && this.meta?.isReady()) { const { errno, attr } = this.meta.getattr(path); cb(errno ?? 0, attr); return; @@ -298,7 +298,7 @@ export default class SftpFuse { cb(errno ?? 0, attr); return; } - if (this.meta?.isReady()) { + if (!path.startsWith("/.") && this.meta?.isReady()) { const { errno, attr } = this.meta.getattr(path); cb(errno ?? 0, attr); return; @@ -394,7 +394,7 @@ export default class SftpFuse { cb(0, this.dirCache.get(path)); return; } - if (this.meta?.isReady() && !path.startsWith(".")) { + if (!path.startsWith("/.") && this.meta?.isReady()) { try { cb(0, this.meta.readdir(path)); } catch (err) { diff --git a/websocketfs/package.json b/websocketfs/package.json index f510c6a..867a192 100644 --- a/websocketfs/package.json +++ b/websocketfs/package.json @@ -1,6 +1,6 @@ { "name": "websocketfs", - "version": "0.12.2", + "version": "0.12.4", "description": "Like sshfs, but over a WebSocket", "main": "./dist/lib/index.js", "scripts": {