From 596526e8800e974681c571a463d4197ea052bb7b Mon Sep 17 00:00:00 2001 From: makearmy Date: Mon, 22 Sep 2025 12:07:36 -0400 Subject: [PATCH] build bug fix --- app/api/submit/settings/route.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/api/submit/settings/route.ts b/app/api/submit/settings/route.ts index 622b0c26..6d340bfe 100644 --- a/app/api/submit/settings/route.ts +++ b/app/api/submit/settings/route.ts @@ -84,11 +84,11 @@ async function readJsonOrMultipart(req: Request): Promise<{ const ct = req.headers.get("content-type") || ""; if (ct.includes("application/json")) { const body = await req.json(); - // JSON mode: allow data URL blobs for images + // JSON mode: allow data URLs for images return { mode: "json", body, files: { photo: null, screen: null } }; } if (ct.includes("multipart/form-data")) { - const form = await (req as any).formData(); + const form = await req.formData(); const payloadRaw = String(form.get("payload") || "{}"); let body: any = {}; try { @@ -200,7 +200,8 @@ export async function POST(req: Request) { name: string, folderPath: string ): Promise { - if ((blobOrFile as File).size && (blobOrFile as File).size > MAX_BYTES) { + const size = (blobOrFile as File).size ?? (blobOrFile as any)?.size ?? 0; + if (size && size > MAX_BYTES) { throw new Error(`File "${name}" exceeds ${MAX_MB} MB`); } const up = await uploadFile(blobOrFile, name, {