Improve handling of edited long message attachments

Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2025-02-26 12:11:27 -06:00 committed by GitHub
commit e5ab61e7c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 357 additions and 77 deletions

View file

@ -11,7 +11,7 @@ import {
} from '../textsecure/processDataMessage';
import type { ProcessedAttachment } from '../textsecure/Types.d';
import { SignalService as Proto } from '../protobuf';
import { IMAGE_GIF, IMAGE_JPEG } from '../types/MIME';
import { IMAGE_GIF, IMAGE_JPEG, LONG_MESSAGE } from '../types/MIME';
import { generateAci } from '../types/ServiceId';
import { uuidToBytes } from '../util/uuidToBytes';
@ -86,6 +86,30 @@ describe('processDataMessage', () => {
]);
});
it('should move long text attachments to bodyAttachment', () => {
const out = check({
attachments: [
UNPROCESSED_ATTACHMENT,
{
...UNPROCESSED_ATTACHMENT,
contentType: LONG_MESSAGE,
},
],
});
assert.deepStrictEqual(out.attachments, [
{
...PROCESSED_ATTACHMENT,
downloadPath: 'random-path',
},
]);
assert.deepStrictEqual(out.bodyAttachment, {
...PROCESSED_ATTACHMENT,
downloadPath: 'random-path',
contentType: LONG_MESSAGE,
});
});
it('should process attachments with incrementalMac/chunkSize', () => {
const out = check({
attachments: [