Add support for receiving attachments from CDN 2

This commit is contained in:
Ehren Kret 2020-04-17 15:51:39 -07:00 committed by Scott Nonnenberg
parent 4dc7631851
commit a0e9791623
16 changed files with 156 additions and 64 deletions

View file

@ -193,9 +193,10 @@ async function _runJob(job) {
// Attachments on the server expire after 30 days, then start returning 404
if (error && error.code === 404) {
logger.warn(
`_runJob: Got 404 from server, marking attachment ${
attachment.id
} from message ${message.idForLogging()} as permanent error`
`_runJob: Got 404 from server for CDN ${
attachment.cdnNumber
}, marking attachment ${attachment.cdnId ||
attachment.cdnKey} from message ${message.idForLogging()} as permanent error`
);
await _finishJob(message, id);

View file

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