From 8e762797c0f14e436499a5ef2d46126544a095c6 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Wed, 21 Mar 2018 18:24:38 -0400 Subject: [PATCH] Remove attachment validation Turns out `fileName` is optional and maybe even `contentType`. We should revisit this at a later point in time. --- js/modules/types/attachment.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/modules/types/attachment.js b/js/modules/types/attachment.js index cb257c212..d37a95454 100644 --- a/js/modules/types/attachment.js +++ b/js/modules/types/attachment.js @@ -29,8 +29,9 @@ const { migrateDataToFileSystem } = require('./attachment/migrate_data_to_file_s // schemaVersion: integer // } -// Returns true if `rawAttachment` is a valid attachment based on our (limited) -// criteria. Over time, we can expand this definition to become more narrow: +// Returns true if `rawAttachment` is a valid attachment based on our current schema. +// Over time, we can expand this definition to become more narrow, e.g. require certain +// fields, etc. exports.isValid = (rawAttachment) => { // NOTE: We cannot use `_.isPlainObject` because `rawAttachment` is // deserialized by protobuf: @@ -38,10 +39,7 @@ exports.isValid = (rawAttachment) => { return false; } - const hasValidContentType = isString(rawAttachment.contentType); - const hasValidFileName = - isString(rawAttachment.fileName) || rawAttachment.fileName === null; - return hasValidContentType && hasValidFileName; + return true; }; // Upgrade steps