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,5 +1,6 @@
|
||||
import { unlink } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { getRuntimeResolve } from "@/lib/utils/runtime-path";
|
||||
|
||||
/**
|
||||
* Best-effort local file delete for camera photos hosted under /public.
|
||||
@@ -25,8 +26,11 @@ export async function tryRemoveLocalPhotoFile(url: string): Promise<boolean> {
|
||||
if (!pathname.startsWith("/")) return false;
|
||||
const rel = pathname.replace(/^\/+/, "");
|
||||
if (!rel || rel.includes("..")) return false;
|
||||
const publicRoot = path.resolve(process.cwd(), "public");
|
||||
const full = path.resolve(publicRoot, rel);
|
||||
const publicRoot = /*turbopackIgnore: true*/ getRuntimeResolve(
|
||||
process.cwd(),
|
||||
"public",
|
||||
);
|
||||
const full = getRuntimeResolve(publicRoot, rel);
|
||||
if (!full.startsWith(publicRoot + path.sep) && full !== publicRoot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user