Check that the unannounced post is an announce

master
Bob Mottram 2019-07-12 11:09:15 +01:00
parent dec34f9941
commit 050f2f5484
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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'):