mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(media): keep file-store keys portable
This commit is contained in:
+2
-2
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user