From 90c6e9bef58214374064d56d822bd6a95756854f Mon Sep 17 00:00:00 2001 From: ProgrammerIn-wonderland <3838shah@gmail.com> Date: Sun, 10 Nov 2024 15:51:03 -0500 Subject: [PATCH] just to be safe, strip "/" --- src/api/LocalFS.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/LocalFS.ts b/src/api/LocalFS.ts index 9de07f8b..77db7992 100644 --- a/src/api/LocalFS.ts +++ b/src/api/LocalFS.ts @@ -743,7 +743,9 @@ class LocalFS extends AFSProvider { // } const fileName = this.path.basename(path); - const [parentHandle, realParent] = await this.getChildDirHandle( + + // eslint-disable-next-line prefer-const + let [parentHandle, realParent] = await this.getChildDirHandle( this.path.dirname(path), ); const fileHandleWritable = await ( @@ -752,6 +754,8 @@ class LocalFS extends AFSProvider { fileHandleWritable.write(target); fileHandleWritable.close(); + if (realParent.startsWith("/")) realParent = realParent.slice(1); + const fullPath = realParent + "/" + fileName; const fileStats = this.stats.get(fullPath) || {}; if (fullPath) {