From df693ade7c4e130281b59340ffb6b5bf9a039eee Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Tue, 13 Mar 2018 22:20:10 -0400 Subject: [PATCH] Allow `Attachment.fileName` to be `null` --- js/modules/types/attachment.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/modules/types/attachment.js b/js/modules/types/attachment.js index 1e09ad338..6c0f43343 100644 --- a/js/modules/types/attachment.js +++ b/js/modules/types/attachment.js @@ -27,7 +27,7 @@ exports.CURRENT_SCHEMA_VERSION = 2; // contentType: MIMEType // data: ArrayBuffer // digest: ArrayBuffer -// fileName: string +// fileName: string | null // flags: null // key: ArrayBuffer // size: integer @@ -53,8 +53,10 @@ exports.isValid = (rawAttachment) => { return false; } - return isString(rawAttachment.contentType) && - isString(rawAttachment.fileName); + const hasValidContentType = isString(rawAttachment.contentType); + const hasValidFileName = + isString(rawAttachment.fileName) || rawAttachment.fileName === null; + return hasValidContentType && hasValidFileName; }; // Middleware