@samitouri / QOSami-HFS / commits / dc31b82f

fix: faulty purge-file-attr command, deleting all attributes

Massimo Melina committed Oct 27, 2025 at 23:45 UTC dc31b82fdc17a73267c98b1794c0e850756169db
1 file changed +5 -3
src/fileAttr.ts
+5 -3
@@ -47,9 +47,11 @@ export async function loadFileAttr(path: string, k: string) {
47
48 export async function purgeFileAttr() {
49 let n = 0
50 - await Promise.all(Array.from(fileAttrDb.keys()).map(k =>
51 - access(k).catch(() =>
52 - n++ && void fileAttrDb.del(k) )))
50 + await Promise.all(Array.from(fileAttrDb.keys()).map(k => {
51 + const [fn] = k.split('|')
52 + return fn && access(fn).catch(() =>
53 + n++ && void fileAttrDb.del(k))
54 + }))
55 if (n)
56 await fileAttrDb.rewrite()
57 console.log(`removed ${n} entrie(s)`)