Document why we drop original image data during auto-orient

This commit is contained in:
Daniel Gasienica 2018-02-13 10:46:44 -05:00
parent 4136d6c382
commit 9ac26be1bd
1 changed files with 6 additions and 0 deletions

View File

@ -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, wed preserve the original image data for users who want to
// retain it but due to reports of data loss, we dont 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,