diff --git a/src/media/store.ts b/src/media/store.ts index 375499409002..86b2b2ae4150 100644 --- a/src/media/store.ts +++ b/src/media/store.ts @@ -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()) {