undo path norm whitespace fix

This commit is contained in:
timothycarambat 2024-05-23 12:04:00 -07:00
parent c7e9240801
commit 05488c81e0

View File

@ -82,7 +82,7 @@ async function wipeCollectorStorage() {
if (file === "__HOTDIR__.md") continue;
try {
fs.rmSync(path.join(directory, file));
} catch {}
} catch { }
}
resolve();
});
@ -97,7 +97,7 @@ async function wipeCollectorStorage() {
if (file === ".placeholder") continue;
try {
fs.rmSync(path.join(directory, file));
} catch {}
} catch { }
}
resolve();
});
@ -122,7 +122,7 @@ function isWithin(outer, inner) {
function normalizePath(filepath = "") {
const result = path
.normalize(filepath.replace(/\s/g, "-").trim())
.normalize(filepath.trim())
.replace(/^(\.\.(\/|\\|$))+/, "")
.trim();
if (["..", ".", "/"].includes(result)) throw new Error("Invalid path.");