Remove attachment validation
Turns out `fileName` is optional and maybe even `contentType`. We should revisit this at a later point in time.
This commit is contained in:
parent
0b7ce39ff7
commit
8e762797c0
1 changed files with 4 additions and 6 deletions
|
@ -29,8 +29,9 @@ const { migrateDataToFileSystem } = require('./attachment/migrate_data_to_file_s
|
||||||
// schemaVersion: integer
|
// schemaVersion: integer
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Returns true if `rawAttachment` is a valid attachment based on our (limited)
|
// Returns true if `rawAttachment` is a valid attachment based on our current schema.
|
||||||
// criteria. Over time, we can expand this definition to become more narrow:
|
// Over time, we can expand this definition to become more narrow, e.g. require certain
|
||||||
|
// fields, etc.
|
||||||
exports.isValid = (rawAttachment) => {
|
exports.isValid = (rawAttachment) => {
|
||||||
// NOTE: We cannot use `_.isPlainObject` because `rawAttachment` is
|
// NOTE: We cannot use `_.isPlainObject` because `rawAttachment` is
|
||||||
// deserialized by protobuf:
|
// deserialized by protobuf:
|
||||||
|
@ -38,10 +39,7 @@ exports.isValid = (rawAttachment) => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasValidContentType = isString(rawAttachment.contentType);
|
return true;
|
||||||
const hasValidFileName =
|
|
||||||
isString(rawAttachment.fileName) || rawAttachment.fileName === null;
|
|
||||||
return hasValidContentType && hasValidFileName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Upgrade steps
|
// Upgrade steps
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue