fix bug in vault resolve

This commit is contained in:
Nystik 2026-04-04 00:37:15 +02:00
parent bd6161bd31
commit b4fa193d2d

View file

@ -72,7 +72,9 @@ function resolveVaultPath(vaultRoot, relativePath) {
const cleaned = (relativePath || "").replace(/^\/+/, ""); const cleaned = (relativePath || "").replace(/^\/+/, "");
const resolved = path.resolve(vaultRoot, cleaned); const resolved = path.resolve(vaultRoot, cleaned);
if (!resolved.startsWith(path.resolve(vaultRoot))) { const resolvedRoot = path.resolve(vaultRoot);
if (resolved !== resolvedRoot && !resolved.startsWith(resolvedRoot + path.sep)) {
return null; return null;
} }
return resolved; return resolved;