build bug fix

This commit is contained in:
makearmy 2025-09-22 12:07:36 -04:00
parent 0576bff494
commit 596526e880

View file

@ -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<string> {
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, {