fix(media): keep file-store keys portable

This commit is contained in:
Peter Steinberger
2026-08-10 15:14:10 -07:00
parent 877e9831b9
commit cf432ec871
+2 -2
View File
@@ -84,7 +84,7 @@ function resolveMediaSubdir(subdir: string, caller: string): string {
if (segments.some((segment) => !segment || segment === "." || segment === "..")) {
throw new Error(`${caller}: unsafe media subdir: ${JSON.stringify(subdir)}`);
}
return path.join(...segments);
return path.posix.join(...segments);
}
function resolveMediaScopedDir(subdir: string, caller: string): string {
@@ -102,7 +102,7 @@ function resolveMediaRelativePath(id: string, subdir: string, caller: string): s
throw new Error(`${caller}: unsafe media ID: ${JSON.stringify(id)}`);
}
const safeSubdir = resolveMediaSubdir(subdir, caller);
return safeSubdir ? path.join(safeSubdir, id) : id;
return safeSubdir ? path.posix.join(safeSubdir, id) : id;
}
function openMediaStore(maxBytes = MAX_BYTES, rootDir = resolveMediaDir()) {