Fix Turbopack module resolution for lzma and restore path imports
This commit is contained in:
1 parent
a5044c80d7
commit
e06596391e
35 files changed
+392
-333
No files matched your search
@@ -1,13 +1,14 @@
|
||||
import path from "node:path";
|
||||
import { getRuntimeResolve } from "@/lib/utils/runtime-path";
|
||||
|
||||
/**
|
||||
* Persistent media root. Lives outside `public/` and outside Git so uploads
|
||||
* survive rebuilds, redeploys and `git clean`. Served through /api/media.
|
||||
*/
|
||||
export const MEDIA_ROOT = path.resolve(process.cwd(), "storage", "media");
|
||||
export const MEDIA_ROOT = getRuntimeResolve(process.cwd(), "storage", "media");
|
||||
|
||||
export function resolveMediaPath(...segments: string[]): string {
|
||||
const target = path.resolve(MEDIA_ROOT, ...segments);
|
||||
const target = getRuntimeResolve(MEDIA_ROOT, ...segments);
|
||||
if (target !== MEDIA_ROOT && !target.startsWith(MEDIA_ROOT + path.sep)) {
|
||||
throw new Error("Invalid media path");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user