finally we know how to skip leading slash

This commit is contained in:
fyears 2024-06-12 01:01:30 +08:00
parent 356c563e95
commit adacda7ee5

View File

@ -43,8 +43,13 @@ export class FakeFsLocal extends FakeFs {
for (const entry of localTAbstractFiles) { for (const entry of localTAbstractFiles) {
let r: Entity | undefined = undefined; let r: Entity | undefined = undefined;
let key = entry.path; 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 // ignore
continue; continue;
} else if (entry instanceof TFile) { } else if (entry instanceof TFile) {
@ -61,15 +66,15 @@ export class FakeFsLocal extends FakeFs {
); );
} }
r = { r = {
key: entry.path, // local always unencrypted key: key, // local always unencrypted
keyRaw: entry.path, keyRaw: key,
mtimeCli: mtimeLocal, mtimeCli: mtimeLocal,
mtimeSvr: mtimeLocal, mtimeSvr: mtimeLocal,
size: entry.stat.size, // local always unencrypted size: entry.stat.size, // local always unencrypted
sizeRaw: entry.stat.size, sizeRaw: entry.stat.size,
}; };
} else if (entry instanceof TFolder) { } else if (entry instanceof TFolder) {
key = `${entry.path}/`; key = `${key}/`;
r = { r = {
key: key, key: key,
keyRaw: key, keyRaw: key,