perf(build): make standalone image deterministic
This commit is contained in:
@@ -42,10 +42,10 @@ export async function POST(request: Request) {
|
||||
const stagingDirectory = `${VIDEO_DIR}/staging/${discordId}`;
|
||||
filePath = `${stagingDirectory}/${stagedVideoId}-${safeFileName(originalFilename)}`;
|
||||
|
||||
await mkdir(stagingDirectory, { recursive: true });
|
||||
await mkdir(/* turbopackIgnore: true */ stagingDirectory, { recursive: true });
|
||||
await pipeline(
|
||||
Readable.fromWeb(request.body as never),
|
||||
createWriteStream(filePath, { flags: "wx" }),
|
||||
createWriteStream(/* turbopackIgnore: true */ filePath, { flags: "wx" }),
|
||||
);
|
||||
|
||||
return NextResponse.json({
|
||||
@@ -55,7 +55,7 @@ export async function POST(request: Request) {
|
||||
size: contentLength,
|
||||
});
|
||||
} catch (error) {
|
||||
if (filePath) await unlink(filePath).catch(() => undefined);
|
||||
if (filePath) await unlink(/* turbopackIgnore: true */ filePath).catch(() => undefined);
|
||||
const message = error instanceof Error ? error.message : "Upload failed.";
|
||||
const status =
|
||||
message === "Unauthorized" || message === "Not authenticated" ? 401 : 400;
|
||||
|
||||
Reference in New Issue
Block a user