Fix contact sync for aci-less contacts
This commit is contained in:
parent
6ec9dd60b1
commit
3063262730
2 changed files with 2 additions and 30 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue