Allow for zero-size attachments in maximum size calculation
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
81bf7a838c
commit
72b75a0bfd
1 changed files with 1 additions and 1 deletions
|
@ -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`
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue