From 9dac07b918a33314e48e14e11d78d3dbc2685520 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 1 Apr 2020 13:33:13 -0700 Subject: [PATCH] typecheck --- api/utils/msg.ts | 2 ++ dist/api/utils/msg.js | 2 ++ dist/api/utils/msg.js.map | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/utils/msg.ts b/api/utils/msg.ts index d285441..b68bc23 100644 --- a/api/utils/msg.ts +++ b/api/utils/msg.ts @@ -22,6 +22,8 @@ function addInMediaKey(full:{[k:string]:any}, contactId){ const m = full && full.message if (!(m && m.mediaKey)) return full if (!(m && m.mediaTerms)) return full + if (!(typeof m.mediaKey==='object')) return full + const mediaKey = m.mediaTerms.skipSigning ? '' : m.mediaKey[contactId+''] return fillmsg(full, {mediaKey}) } diff --git a/dist/api/utils/msg.js b/dist/api/utils/msg.js index 28b4113..b3b18b5 100644 --- a/dist/api/utils/msg.js +++ b/dist/api/utils/msg.js @@ -35,6 +35,8 @@ function addInMediaKey(full, contactId) { return full; if (!(m && m.mediaTerms)) return full; + if (!(typeof m.mediaKey === 'object')) + return full; const mediaKey = m.mediaTerms.skipSigning ? '' : m.mediaKey[contactId + '']; return fillmsg(full, { mediaKey }); } diff --git a/dist/api/utils/msg.js.map b/dist/api/utils/msg.js.map index c064b4a..65bdc05 100644 --- a/dist/api/utils/msg.js.map +++ b/dist/api/utils/msg.js.map @@ -1 +1 @@ -{"version":3,"file":"msg.js","sourceRoot":"","sources":["../../../api/utils/msg.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,iCAAuC;AAEvC,SAAS,eAAe,CAAC,IAAqB,EAAE,SAAS;IACxD,MAAM,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,CAAA;IAC9B,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAG,QAAQ,C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