schema check for incomplete data

This commit is contained in:
Daniel Lugo 2020-01-29 11:55:33 -04:00
parent f97a110392
commit d1b6b238bf

View file

@ -343,6 +343,11 @@ const processOutgoings = async () => {
return return
} }
if (!Schema.isPartialOutgoing(out)) {
// incomplete data
return
}
if (typeof currentOutgoings[id] === 'undefined') { if (typeof currentOutgoings[id] === 'undefined') {
// We disable this rule because we are awaiting the result of the whole // We disable this rule because we are awaiting the result of the whole
// for each AND each callback looks only at one single ID // for each AND each callback looks only at one single ID
@ -364,6 +369,10 @@ const processOutgoings = async () => {
await Utils.asyncForEach( await Utils.asyncForEach(
Object.entries(out.messages), Object.entries(out.messages),
async ([msgID, msg]) => { async ([msgID, msg]) => {
if (!Schema.isMessage(msg)) {
// incomplete data
return
}
if (!currentOut.messages[msgID]) { if (!currentOut.messages[msgID]) {
let decryptedBody = '' let decryptedBody = ''
if (msg.body === Actions.INITIAL_MSG) { if (msg.body === Actions.INITIAL_MSG) {