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

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),