Check that message fields exist

main
Bob Mottram 2020-05-02 13:14:55 +00:00
parent a72a3e6d14
commit 78ff64dfc1
1 changed files with 13 additions and 6 deletions

View File

@ -2047,12 +2047,19 @@ def inboxAfterCapabilities(recentPostsCache: {}, maxRecentPosts: int,
nickname = handle.split('@')[0] nickname = handle.split('@')[0]
if validPostContent(baseDir, nickname, domain, if validPostContent(baseDir, nickname, domain,
postJsonObject, maxMentions, maxEmoji): postJsonObject, maxMentions, maxEmoji):
if receiveGitPatch(baseDir, nickname, domain, if isinstance(messageJson['object'], dict):
messageJson['object']['summary'], if messageJson['object'].get('content') and \
messageJson['object']['content']): messageJson['object'].get('summary'):
gitPatchNotify(baseDir, handle, if receiveGitPatch(baseDir, nickname, domain,
messageJson['object']['summary'], messageJson['object']['summary'],
messageJson['object']['content']) 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 # replace YouTube links, so they get less tracking data
replaceYouTube(postJsonObject) replaceYouTube(postJsonObject)