Change order of checks for attachments

This commit is contained in:
Jamie Kyle 2023-09-14 08:35:27 -07:00 committed by GitHub
parent d0df466fbc
commit 7443dd3314
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}