Normalize message attachments

This commit is contained in:
trevor-signal
2025-05-22 21:09:54 -04:00
committed by GitHub
parent 8d8e0329cf
commit d6e81eee11
39 changed files with 2540 additions and 807 deletions

View File

@@ -1,5 +1,6 @@
// Copyright 2019 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { omit } from 'lodash';
import * as log from '../logging/log';
import * as Bytes from '../Bytes';
import type { AttachmentDownloadJobTypeType } from '../types/AttachmentDownload';
@@ -340,7 +341,7 @@ export async function addAttachmentToMessage(
if (thumbnail !== newThumbnail) {
handledInEditHistory = true;
}
return { ...item, thumbnail: newThumbnail };
return { ...item, thumbnail: omit(newThumbnail, 'thumbnail') };
}),
},
};
@@ -362,7 +363,7 @@ export async function addAttachmentToMessage(
return {
...item,
thumbnail: maybeReplaceAttachment(thumbnail),
thumbnail: maybeReplaceAttachment(omit(thumbnail, 'thumbnail')),
};
}),
};