From e5e4c1aa3e59e37db5b5eeeb39414784c2fd5fb1 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 1 Mar 2024 11:15:24 -0800 Subject: [PATCH] Allow for zero-size attachments in maximum size calculation --- 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 1b322b217391..f08e7af40ee9 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` );