Check that size is number, not truthiness of size
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import Long from 'long';
|
import Long from 'long';
|
||||||
import { ReceiptCredentialPresentation } from '@signalapp/libsignal-client/zkgroup';
|
import { ReceiptCredentialPresentation } from '@signalapp/libsignal-client/zkgroup';
|
||||||
|
import { isNumber } from 'lodash';
|
||||||
|
|
||||||
import { assert, strictAssert } from '../util/assert';
|
import { assert, strictAssert } from '../util/assert';
|
||||||
import { dropNull, shallowDropNull } from '../util/dropNull';
|
import { dropNull, shallowDropNull } from '../util/dropNull';
|
||||||
@@ -50,7 +51,7 @@ export function processAttachment(
|
|||||||
const hasCdnId = Long.isLong(cdnId) ? !cdnId.isZero() : Boolean(cdnId);
|
const hasCdnId = Long.isLong(cdnId) ? !cdnId.isZero() : Boolean(cdnId);
|
||||||
|
|
||||||
const { contentType, digest, key, size } = attachment;
|
const { contentType, digest, key, size } = attachment;
|
||||||
if (!size) {
|
if (!isNumber(size)) {
|
||||||
throw new Error('Missing size on incoming attachment!');
|
throw new Error('Missing size on incoming attachment!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user