From adacda7ee5cf95cfaeb646bb4a0862925e9a4d02 Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Wed, 12 Jun 2024 01:01:30 +0800 Subject: [PATCH] finally we know how to skip leading slash --- src/fsLocal.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fsLocal.ts b/src/fsLocal.ts index 601ce71..1111b1f 100644 --- a/src/fsLocal.ts +++ b/src/fsLocal.ts @@ -43,8 +43,13 @@ export class FakeFsLocal extends FakeFs { for (const entry of localTAbstractFiles) { let r: Entity | undefined = undefined; let key = entry.path; + if (key.startsWith("/")) { + // why? + // just remove leading slash / + key = key.slice(1); + } - if (entry.path === "/") { + if (entry.path === "/" || entry.path === "") { // ignore continue; } else if (entry instanceof TFile) { @@ -61,15 +66,15 @@ export class FakeFsLocal extends FakeFs { ); } r = { - key: entry.path, // local always unencrypted - keyRaw: entry.path, + key: key, // local always unencrypted + keyRaw: key, mtimeCli: mtimeLocal, mtimeSvr: mtimeLocal, size: entry.stat.size, // local always unencrypted sizeRaw: entry.stat.size, }; } else if (entry instanceof TFolder) { - key = `${entry.path}/`; + key = `${key}/`; r = { key: key, keyRaw: key,