From f0975c2fd076be871966dc266994121d1e3ca354 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Fri, 1 Mar 2024 17:36:45 -0600 Subject: [PATCH] Allow for zero-size attachments in maximum size calculation Co-authored-by: Scott Nonnenberg --- ts/messageModifiers/AttachmentDownloads.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/messageModifiers/AttachmentDownloads.ts b/ts/messageModifiers/AttachmentDownloads.ts index 1b322b2173..f08e7af40e 100644 --- a/ts/messageModifiers/AttachmentDownloads.ts +++ b/ts/messageModifiers/AttachmentDownloads.ts @@ -289,7 +289,7 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise { const { size } = attachment; const sizeInKib = size / KIBIBYTE; - if (!size || sizeInKib > maxInKib) { + if (!Number.isFinite(size) || size < 0 || sizeInKib > maxInKib) { throw new AttachmentSizeError( `Attachment Job ${id}: Attachment was ${sizeInKib}kib, max is ${maxInKib}kib` );