Skip to content

Commit

Permalink
properly exclude hidden top level files
Browse files Browse the repository at this point in the history
  • Loading branch information
williamstein committed Nov 16, 2023
1 parent 359789b commit c22d318
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion websocketfs/lib/metadata-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 3 additions & 3 deletions websocketfs/lib/sftp-fuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion websocketfs/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit c22d318

Please sign in to comment.