Extra checks on likes

master
Bob Mottram 2019-09-05 20:19:52 +01:00
parent 83c10b5906
commit 69c14dd7bf
1 changed files with 4 additions and 0 deletions

View File

@ -37,6 +37,8 @@ def undoLikesCollectionEntry(postFilename: str,objectUrl: str,actor: str,debug:
return
if not postJsonObject['object'].get('likes'):
return
if not isinstance(postJsonObject['object']['likes'], dict):
return
if not postJsonObject['object']['likes'].get('items'):
return
totalItems=0
@ -81,6 +83,8 @@ def noOfLikes(postJsonObject: {}) -> int:
return 0
if not postJsonObject['object'].get('likes'):
return 0
if not isinstance(postJsonObject['object']['likes'], dict):
return 0
if not postJsonObject['object']['likes'].get('items'):
postJsonObject['object']['likes']['items']=[]
postJsonObject['object']['likes']['totalItems']=0