diff --git a/server/env.ts b/server/env.ts index 9b98e96bb..6c89dcd1c 100644 --- a/server/env.ts +++ b/server/env.ts @@ -253,15 +253,6 @@ export class Environment { process.env.ENABLE_UPDATES ?? process.env.TELEMETRY ?? "true" ); - /** - * Because imports can be much larger than regular file attachments and are - * deleted automatically we allow an optional separate limit on the size of - * imports. - */ - @IsNumber() - public MAXIMUM_IMPORT_SIZE = - this.toOptionalNumber(process.env.MAXIMUM_IMPORT_SIZE) ?? 5120000; - /** * An optional comma separated list of allowed domains. */ @@ -562,7 +553,7 @@ export class Environment { @IsOptional() @IsNumber() public AWS_S3_UPLOAD_MAX_SIZE = - this.toOptionalNumber(process.env.AWS_S3_UPLOAD_MAX_SIZE) ?? 10000000000; + this.toOptionalNumber(process.env.AWS_S3_UPLOAD_MAX_SIZE) ?? 100000000; /** * Set default AWS S3 ACL for file attachments. @@ -570,6 +561,17 @@ export class Environment { @IsOptional() public AWS_S3_ACL = process.env.AWS_S3_ACL ?? "private"; + /** + * Because imports can be much larger than regular file attachments and are + * deleted automatically we allow an optional separate limit on the size of + * imports. + */ + @IsNumber() + public MAXIMUM_IMPORT_SIZE = Math.max( + this.toOptionalNumber(process.env.MAXIMUM_IMPORT_SIZE) ?? 100000000, + this.AWS_S3_UPLOAD_MAX_SIZE + ); + /** * The product name */ diff --git a/server/models/helpers/AttachmentHelper.ts b/server/models/helpers/AttachmentHelper.ts index f9a0d4821..6933ff07d 100644 --- a/server/models/helpers/AttachmentHelper.ts +++ b/server/models/helpers/AttachmentHelper.ts @@ -65,10 +65,10 @@ export default class AttachmentHelper { */ static presetToMaxUploadSize(preset: AttachmentPreset) { switch (preset) { - case AttachmentPreset.Avatar: - return Math.min(1024 * 1024 * 5, env.AWS_S3_UPLOAD_MAX_SIZE); case AttachmentPreset.Import: return env.MAXIMUM_IMPORT_SIZE; + case AttachmentPreset.Avatar: + case AttachmentPreset.DocumentAttachment: default: return env.AWS_S3_UPLOAD_MAX_SIZE; }