Allow for zero-size attachments in maximum size calculation
This commit is contained in:
@@ -289,7 +289,7 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
|||||||
const { size } = attachment;
|
const { size } = attachment;
|
||||||
const sizeInKib = size / KIBIBYTE;
|
const sizeInKib = size / KIBIBYTE;
|
||||||
|
|
||||||
if (!size || sizeInKib > maxInKib) {
|
if (!Number.isFinite(size) || size < 0 || sizeInKib > maxInKib) {
|
||||||
throw new AttachmentSizeError(
|
throw new AttachmentSizeError(
|
||||||
`Attachment Job ${id}: Attachment was ${sizeInKib}kib, max is ${maxInKib}kib`
|
`Attachment Job ${id}: Attachment was ${sizeInKib}kib, max is ${maxInKib}kib`
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user