From 9ac26be1bd783cd5070d886de107dd3ad9c91ad1 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Tue, 13 Feb 2018 10:46:44 -0500 Subject: [PATCH] Document why we drop original image data during auto-orient --- js/modules/types/attachment.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/modules/types/attachment.js b/js/modules/types/attachment.js index 80dc12a4c..34a374bfa 100644 --- a/js/modules/types/attachment.js +++ b/js/modules/types/attachment.js @@ -83,6 +83,12 @@ const autoOrientJPEG = async (attachment) => { const dataBlob = arrayBufferToBlob(attachment.data, attachment.contentType); const newDataBlob = dataURLToBlob(await autoOrientImage(dataBlob)); const newDataArrayBuffer = await blobToArrayBuffer(newDataBlob); + + // IMPORTANT: We overwrite the existing `data` `ArrayBuffer` losing the original + // image data. Ideally, we’d preserve the original image data for users who want to + // retain it but due to reports of data loss, we don’t want to overburden IndexedDB + // by potentially doubling stored image data. + // See: https://github.com/signalapp/Signal-Desktop/issues/1589 const newAttachment = Object.assign({}, attachment, { data: newDataArrayBuffer, size: newDataArrayBuffer.byteLength,