This commit is contained in:
2026-09-26 15:23:36 +02:00
parent 990f463534
commit 27f5e3563f
18 changed files with 1226 additions and 559 deletions
+4 -4
View File
@@ -89,7 +89,7 @@ export const handleBrandImageUpload = async (req, res) => {
return sendJson(res, { success: false, msg: 'Invalid content type — multipart boundary missing' }, 400);
}
const body = await collectBody(req, 5 * 1024 * 1024); // 5 MB hard cap
const body = await collectBody(req, 10 * 1024 * 1024); // 10 MB request body cap
const parts = parseMultipart(body, boundaryMatch[1]);
const file = parts.file;
@@ -97,12 +97,12 @@ export const handleBrandImageUpload = async (req, res) => {
return sendJson(res, { success: false, msg: 'No file provided' }, 400);
}
// 2 MB soft cap
const maxSize = 2 * 1024 * 1024;
// 5 MB cap
const maxSize = 5 * 1024 * 1024;
if (file.data.length > maxSize) {
return sendJson(res, {
success: false,
msg: `File too large. Maximum is 2 MB, got ${(file.data.length / 1024 / 1024).toFixed(2)} MB`
msg: `File too large. Maximum is 5 MB, got ${(file.data.length / 1024 / 1024).toFixed(2)} MB`
}, 400);
}