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:
@@ -65,7 +65,7 @@ async function main(): Promise<void> {
|
||||
|
||||
await app.register(multipart, {
|
||||
limits: {
|
||||
fileSize: 5 * 1024 * 1024 * 1024, // 5GB hard ceiling — actual limit enforced per-request from DB
|
||||
fileSize: Number.MAX_SAFE_INTEGER, // No global cap — actual limit enforced per-request from DB
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user