diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index f39ff5cd7f..39bc63ccbf 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -3881,9 +3881,19 @@ export default class MessageReceiver } if (blocked.acis) { const previous = this.storage.get('blocked-uuids', []); - const acis = blocked.acis.map((aci, index) => { - return normalizeAci(aci, `handleBlocked.acis.${index}`); - }); + const acis = blocked.acis + .map((aci, index) => { + try { + return normalizeAci(aci, `handleBlocked.acis.${index}`); + } catch (error) { + log.warn( + `${logId}: ACI ${aci} was malformed`, + Errors.toLogFormat(error) + ); + return undefined; + } + }) + .filter(isNotNil); const { added, removed } = diffArraysAsSets(previous, acis); if (added.length) { diff --git a/ts/util/normalizeAci.ts b/ts/util/normalizeAci.ts index 0ecc8d66a7..ad3d1ba5f9 100644 --- a/ts/util/normalizeAci.ts +++ b/ts/util/normalizeAci.ts @@ -29,7 +29,10 @@ export function normalizeAci( } const result = rawAci.toLowerCase(); - strictAssert(!result.startsWith('pni:'), 'ACI should not start with PNI:'); + strictAssert( + !result.startsWith('pni:'), + `ACI should not start with 'PNI:' in ${context}` + ); if (!isAciString(result)) { logger.warn(