mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Document Message v4, remove data-free thumbnails
This commit is contained in:
@@ -18,6 +18,9 @@ const PRIVATE = 'private';
|
||||
// - Attachments: Sanitize Unicode order override characters.
|
||||
// Version 3
|
||||
// - Attachments: Write attachment data to disk and store relative path to it.
|
||||
// Version 4
|
||||
// - Quotes: Write thumbnail data to disk and store relative path to it.
|
||||
|
||||
|
||||
const INITIAL_SCHEMA_VERSION = 0;
|
||||
|
||||
@@ -158,13 +161,19 @@ exports._mapQuotedAttachments = upgradeAttachment => async (message, context) =>
|
||||
}
|
||||
|
||||
const upgradeWithContext = async (attachment) => {
|
||||
if (!attachment || !attachment.thumbnail) {
|
||||
const { thumbnail } = attachment;
|
||||
if (!thumbnail) {
|
||||
return attachment;
|
||||
}
|
||||
|
||||
const thumbnail = await upgradeAttachment(attachment.thumbnail, context);
|
||||
if (!thumbnail.data) {
|
||||
console.log('Quoted attachment did not have thumbnail data; removing it');
|
||||
return omit(attachment, ['thumbnail']);
|
||||
}
|
||||
|
||||
const upgradedThumbnail = await upgradeAttachment(thumbnail, context);
|
||||
return Object.assign({}, attachment, {
|
||||
thumbnail,
|
||||
thumbnail: upgradedThumbnail,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user