Fix roundtripping of voice notes with body

This commit is contained in:
Fedor Indutny 2025-04-16 14:27:47 -07:00 committed by GitHub
commit 0b5f0df1ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 14 deletions

View file

@ -355,6 +355,39 @@ describe('backup/attachments', () => {
{ backupLevel: BackupLevel.Paid }
);
});
it('drops voice message flag when body is present', async () => {
const attachment = composeAttachment(1);
attachment.contentType = AUDIO_MP3;
attachment.flags = SignalService.AttachmentPointer.Flags.VOICE_MESSAGE;
strictAssert(isVoiceMessage(attachment), 'it is a voice attachment');
strictAssert(attachment.digest, 'digest exists');
await asymmetricRoundtripHarness(
[
composeMessage(1, {
body: 'hello',
attachments: [attachment],
}),
],
[
composeMessage(1, {
body: 'hello',
hasAttachments: true,
attachments: [
{
...omit(attachment, NON_ROUNDTRIPPED_BACKUP_LOCATOR_FIELDS),
flags: undefined,
backupLocator: {
mediaName: digestToMediaName(attachment.digest),
},
},
],
}),
],
{ backupLevel: BackupLevel.Paid }
);
});
});
describe('Preview attachments', () => {