diff --git a/ts/state/ducks/composer.ts b/ts/state/ducks/composer.ts index 0847e97d2b3..4f878aa23ea 100644 --- a/ts/state/ducks/composer.ts +++ b/ts/state/ducks/composer.ts @@ -1135,14 +1135,6 @@ function preProcessAttachment( return; } - const limitKb = getMaximumAttachmentSizeInKb(getRemoteConfigValue); - if (file.size / KIBIBYTE > limitKb) { - return { - toastType: ToastType.FileSize, - parameters: getRenderDetailsForLimit(limitKb), - }; - } - if (isFileDangerous(file.name)) { return { toastType: ToastType.DangerousFileType }; } @@ -1171,6 +1163,16 @@ function preProcessAttachment( return { toastType: ToastType.CannotMixMultiAndNonMultiAttachments }; } + // Putting this after everything else because the other checks are more + // important to show to the user. + const limitKb = getMaximumAttachmentSizeInKb(getRemoteConfigValue); + if (file.size / KIBIBYTE > limitKb) { + return { + toastType: ToastType.FileSize, + parameters: getRenderDetailsForLimit(limitKb), + }; + } + return undefined; }