fix: couldn't delete a file on Windows if comments are configured to be stored in attributes #1035
Massimo Melina committed
Jul 4, 2025 at 14:24 UTC
e6994fae26be1b7bf2e7ec11635c91da9da4197a
1 file changed
+2
-2
src/fileAttr.ts
+2
-2
@@ -23,8 +23,8 @@ const FILE_ATTR_PREFIX = 'user.hfs.' // user. prefix to be linux compatible
23
export async function storeFileAttr(path: string, k: string, v: any) {
24
const s = await stat(path).catch(() => null)
25
// since we don't have fsx.remove, we simulate it with an empty string
26
- if (await fsx?.set(path, FILE_ATTR_PREFIX + k, v === undefined ? '' : JSON.stringify(v)).then(() => 1, () => 0)) {
27
- if (s && IS_WINDOWS) utimes(path, s.atime, s.mtime) // restore timestamps, necessary only on Windows
26
+ if (s && await fsx?.set(path, FILE_ATTR_PREFIX + k, v === undefined ? '' : JSON.stringify(v)).then(() => 1, () => 0)) {
27
+ if (IS_WINDOWS) utimes(path, s.atime, s.mtime) // restore timestamps, necessary only on Windows
28
return true
29
}
30
// fallback to our kv-storage