ducks/composer: Properly compare attachment size against limit

This commit is contained in:
Scott Nonnenberg 2023-01-06 10:31:45 -08:00 committed by GitHub
parent 74abe0c1ef
commit aa1f96cb6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,7 +50,7 @@ import {
resetLinkPreview,
suspendLinkPreviews,
} from '../../services/LinkPreview';
import { getMaximumAttachmentSizeInKb } from '../../util/attachments';
import { getMaximumAttachmentSizeInKb, KIBIBYTE } from '../../util/attachments';
import { getRecipientsByConversation } from '../../util/getRecipientsByConversation';
import {
getRenderDetailsForLimit,
@ -901,7 +901,7 @@ function preProcessAttachment(
}
const limitKb = getMaximumAttachmentSizeInKb();
if (file.size > limitKb) {
if (file.size / KIBIBYTE > limitKb) {
return {
toastType: ToastType.FileSize,
parameters: getRenderDetailsForLimit(limitKb),