catch exception when failing to decode/read an attachment

pull/2115/head
Audric Ackermann 4 years ago
parent 1424e13a68
commit 4a530582b1
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -84,6 +84,8 @@ export const getDecryptedMediaUrl = async (
urlToDecryptingPromise.set(
url,
new Promise(async resolve => {
window.log.info('about to read and decrypt file :', url);
try {
const encryptedFileContent = await fse.readFile(url);
const decryptedContent = await decryptAttachmentBuffer(
toArrayBuffer(encryptedFileContent)
@ -100,6 +102,7 @@ export const getDecryptedMediaUrl = async (
forceRetain: isAvatar,
});
}
window.log.info(' file decrypted :', url);
urlToDecryptingPromise.delete(url);
resolve(obj);
return;
@ -107,9 +110,14 @@ export const getDecryptedMediaUrl = async (
// failed to decrypt, fallback to url image loading
// it might be a media we received before the update encrypting attachments locally.
urlToDecryptingPromise.delete(url);
window.log.info('error decrypting file :', url);
resolve(url);
return;
}
} catch (e) {
window.log.warn(e);
}
})
);

Loading…
Cancel
Save