Improve handling of edited long message attachments

This commit is contained in:
trevor-signal
2025-02-25 14:23:36 -05:00
committed by GitHub
parent da2741ba31
commit 6f9438c74f
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: [