From 78ff64dfc12c1f560f02f4094086c80b8f20a077 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 2 May 2020 13:14:55 +0000 Subject: [PATCH] Check that message fields exist --- inbox.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/inbox.py b/inbox.py index 031bdf1b6..c7ac2fd42 100644 --- a/inbox.py +++ b/inbox.py @@ -2047,12 +2047,19 @@ def inboxAfterCapabilities(recentPostsCache: {}, maxRecentPosts: int, nickname = handle.split('@')[0] if validPostContent(baseDir, nickname, domain, postJsonObject, maxMentions, maxEmoji): - if receiveGitPatch(baseDir, nickname, domain, - messageJson['object']['summary'], - messageJson['object']['content']): - gitPatchNotify(baseDir, handle, - messageJson['object']['summary'], - messageJson['object']['content']) + if isinstance(messageJson['object'], dict): + if messageJson['object'].get('content') and \ + messageJson['object'].get('summary'): + if receiveGitPatch(baseDir, nickname, domain, + messageJson['object']['summary'], + messageJson['object']['content']): + gitPatchNotify(baseDir, handle, + messageJson['object']['summary'], + messageJson['object']['content']) + elif '[PATCH]' in messageJson['object']['content']: + print('WARN: git patch not accepted - ' + + messageJson['object']['summary']) + return False # replace YouTube links, so they get less tracking data replaceYouTube(postJsonObject)