@samitouri / QOSami-HFS / commits / 0c4c06a6

fix: command 'purge-file-attr' not removing attr for first missing file

Massimo Melina committed Jul 16, 2026 at 22:45 UTC 0c4c06a624cd8faa838ba60bd972706cf1344889
1 file changed +5 -2
src/fileAttr.ts
+5 -2
@@ -43,12 +43,15 @@ export async function loadFileAttr(path: string, k: string) {
43 ?? undefined // normalize, as we get null instead of undefined on windows
44 }
45
46 +// remove file-attr for files that don't exist anymore
47 export async function purgeFileAttr() {
48 let n = 0
49 await Promise.all(Array.from(fileAttrDb.keys()).map(k => {
50 const fn = splitFileAttrKey(k)?.filePath
50 - return fn && access(fn).catch(() =>
51 - n++ && void fileAttrDb.del(k))
51 + return fn && access(fn).catch(() => {
52 + n++
53 + return fileAttrDb.del(k)
54 + })
55 }))
56 if (n)
57 await fileAttrDb.rewrite()