feat(storage): remove upload-size cap, add MB/GB unit toggle

Storage panel's max-upload-size input now accepts any positive integer
(bounded only by JS safe-integer ceiling) and offers an MB/GB unit
toggle. Multipart limit relaxed to MAX_SAFE_INTEGER — actual cap is
enforced per-request from the DB setting, not at the framework layer.
This commit is contained in:
Jannis Braun
2026-04-28 18:37:16 +02:00
parent 213fbc943b
commit 76b6621d62
4 changed files with 68 additions and 19 deletions
+4 -3
View File
@@ -233,10 +233,11 @@ export async function settingsRoutes(app: FastifyInstance): Promise<void> {
if (body.maxUploadSizeMb !== undefined) {
const mb = Number(body.maxUploadSizeMb);
if (isNaN(mb) || mb < 1 || mb > 5120) {
return reply.code(400).send({ error: 'maxUploadSizeMb must be between 1 and 5120', statusCode: 400 });
const MAX_MB = Math.floor(Number.MAX_SAFE_INTEGER / (1024 * 1024));
if (!Number.isFinite(mb) || !Number.isInteger(mb) || mb < 1 || mb > MAX_MB) {
return reply.code(400).send({ error: `maxUploadSizeMb must be a positive integer (1 - ${MAX_MB})`, statusCode: 400 });
}
updateData.maxUploadSizeBytes = Math.round(mb * 1024 * 1024);
updateData.maxUploadSizeBytes = mb * 1024 * 1024;
}
if (body.federationRelayEnabled !== undefined) {