From 050f2f5484d92675aaf9c55b3243c8c11912637c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 12 Jul 2019 11:09:15 +0100 Subject: [PATCH] Check that the unannounced post is an announce --- inbox.py | 7 +++++++ like.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inbox.py b/inbox.py index 56f30dbd..00eaea79 100644 --- a/inbox.py +++ b/inbox.py @@ -625,6 +625,13 @@ def receiveUndoAnnounce(session,handle: str,baseDir: str, \ return True if debug: print('DEBUG: announced/repeated post to be undone found in inbox') + with open(postFilename, 'r') as fp: + postJson=commentjson.load(fp) + if not postJson.get('type'): + if postJson['type']!='Announce': + if debug: + print("DEBUG: Attenpt to undo something which isn't an announcement") + return False os.remove(postFilename) return True diff --git a/like.py b/like.py index dc5fb146..f6719128 100644 --- a/like.py +++ b/like.py @@ -21,7 +21,7 @@ def undoLikesCollectionEntry(postFilename: str,objectUrl: str, actor: str,debug: with open(postFilename, 'r') as fp: postJson=commentjson.load(fp) if not postJson.get('type'): - if not postJson['type']=='Create': + if postJson['type']!='Create': return return if not postJson.get('object'):