From 9017a38b6ee9a7321fce40a59505a1c25fd4cbb0 Mon Sep 17 00:00:00 2001 From: Pablo Sanfilippo Date: Mon, 25 Aug 2025 11:49:16 -0300 Subject: [PATCH] Don't use index cache in stat --- src/access.ts | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/src/access.ts b/src/access.ts index b7dec00..c475cd8 100644 --- a/src/access.ts +++ b/src/access.ts @@ -106,35 +106,26 @@ export class WebAccessFS extends Async(IndexFS) { } async stat(path: string): Promise { - try { - return await super.stat(path); - } catch (ex: any) { - if (ex.code != 'ENOENT') throw ex; - - // This handle must have been created after initialization - // Try to add a new inode for the handle to the index + const handle = await this.get(null, path); + const inode = new Inode(); - const handle = await this.get(null, path); - const inode = new Inode(); - - if (isKind(handle, 'file')) { - const file = await handle.getFile(); - inode.update({ - mode: 0o644 | constants.S_IFREG, - size: file.size, - mtimeMs: file.lastModified, - }); - } else { - inode.update({ - mode: constants.S_IFDIR | 0o777, - size: 0, - }); - } + if (isKind(handle, 'file')) { + const file = await handle.getFile(); + inode.update({ + mode: 0o644 | constants.S_IFREG, + size: file.size, + mtimeMs: file.lastModified, + }); + } else { + inode.update({ + mode: constants.S_IFDIR | 0o777, + size: 0, + }); + } - this.index.set(path, inode); + this.index.set(path, inode); - return inode; - } + return inode; } async readdir(path: string): Promise {