More validation

merge-requests/8/head
Bob Mottram 2020-08-12 09:53:26 +00:00
parent 5ad90d1b01
commit c6ffdb2f83
1 changed files with 6 additions and 0 deletions

View File

@ -81,6 +81,12 @@ def announcedByPerson(postJsonObject: {}, nickname: str, domain: str) -> bool:
# not to be confused with shared items
if not postJsonObject['object'].get('shares'):
return False
if not isinstance(postJsonObject['shares'], dict):
return False
if not postJsonObject['object']['shares'].get('items'):
return False
if not isinstance(postJsonObject['object']['shares']['items'], list):
return False
actorMatch = domain + '/users/' + nickname
for item in postJsonObject['object']['shares']['items']:
if item['actor'].endswith(actorMatch):