diff --git a/ts/test-electron/ContactsParser_test.ts b/ts/test-electron/ContactsParser_test.ts index f10b05eab0..3bef8edc93 100644 --- a/ts/test-electron/ContactsParser_test.ts +++ b/ts/test-electron/ContactsParser_test.ts @@ -127,35 +127,6 @@ describe('ContactsParser', () => { } } }); - - it('parses an array buffer of contacts where contacts are dropped due to missing ACI', async () => { - let absolutePath: string | undefined; - - try { - const avatarBuffer = generateAvatar(); - const bytes = Bytes.concatenate([ - generatePrefixedContact(avatarBuffer, null), - avatarBuffer, - generatePrefixedContact(undefined, null), - getTestBuffer(), - ]); - - const fileName = generateGuid(); - absolutePath = join(tempDir, fileName); - writeFileSync(absolutePath, bytes); - - const contacts = await parseContactsWithSmallChunkSize({ - absolutePath, - }); - assert.strictEqual(contacts.length, 3); - - await Promise.all(contacts.map(contact => verifyContact(contact))); - } finally { - if (absolutePath) { - unlinkSync(absolutePath); - } - } - }); }); }); diff --git a/ts/textsecure/ContactsParser.ts b/ts/textsecure/ContactsParser.ts index 38c0a7c58a..2d9aef7128 100644 --- a/ts/textsecure/ContactsParser.ts +++ b/ts/textsecure/ContactsParser.ts @@ -13,6 +13,7 @@ import type { AciString } from '../types/ServiceId'; import { computeHash } from '../Crypto'; import { dropNull } from '../util/dropNull'; import { fromAciUuidBytesOrString } from '../util/ServiceId'; +import * as Bytes from '../Bytes'; import { decryptAttachmentV2ToSink } from '../AttachmentCrypto'; import Avatar = Proto.ContactDetails.IAvatar; @@ -204,7 +205,7 @@ function prepareContact( const aci = fromAciUuidBytesOrString(aciBinary, rawAci, 'ContactBuffer.aci'); - if (aci == null) { + if ((Bytes.isNotEmpty(aciBinary) || rawAci) && aci == null) { log.warn('ParseContactsTransform: Dropping contact with invalid aci'); return undefined; }