Ensure old attachments with .id field only are handled

This commit is contained in:
Scott Nonnenberg 2020-04-20 11:22:12 -07:00
parent a0e9791623
commit aaa91c441b
2 changed files with 5 additions and 1 deletions

View File

@ -188,6 +188,10 @@ async function _runJob(job) {
}
try {
if (attachment.id) {
// eslint-disable-next-line no-param-reassign
attachment.cdnId = attachment.id;
}
downloaded = await messageReceiver.downloadAttachment(attachment);
} catch (error) {
// Attachments on the server expire after 30 days, then start returning 404

View File

@ -387,7 +387,7 @@ function _getExportAttachmentFileName(message, index, attachment) {
return _trimFileName(attachment.fileName);
}
let name = attachment.cdnId || attachment.cdnKey;
let name = attachment.cdnId || attachment.cdnKey || attachment.id;
if (attachment.contentType) {
const components = attachment.contentType.split('/');