mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
sometimes attributedTo is a list of strings
This commit is contained in:
parent
3a526e0ca7
commit
cf14b186c1
1 changed files with 13 additions and 8 deletions
|
@ -2217,18 +2217,23 @@ def ensure_domains_match(activity: dict) -> bool:
|
|||
if 'id' in activity:
|
||||
note_id = activity['id']
|
||||
else:
|
||||
note_id = None
|
||||
note_id = None
|
||||
|
||||
note_actor = None
|
||||
if 'actor' in activity:
|
||||
note_actor = activity['actor']
|
||||
elif 'attributedTo' in activity and isinstance(activity['attributedTo'], str):
|
||||
note_actor = activity['attributedTo']
|
||||
elif 'attributedTo' in activity and isinstance(activity['attributedTo'], list):
|
||||
for a in activity['attributedTo']:
|
||||
if a['type'] == 'Person':
|
||||
note_actor = a['id']
|
||||
break
|
||||
elif 'attributedTo' in activity:
|
||||
attributed_to = activity['attributedTo']
|
||||
if isinstance(attributed_to, str):
|
||||
note_actor = attributed_to
|
||||
elif isinstance(attributed_to, list):
|
||||
for a in attributed_to:
|
||||
if isinstance(a, dict) and a.get('type') == 'Person':
|
||||
note_actor = a.get('id')
|
||||
break
|
||||
elif isinstance(a, str):
|
||||
note_actor = a
|
||||
break
|
||||
|
||||
if note_id and note_actor:
|
||||
parsed_url = urlparse(note_id)
|
||||
|
|
Loading…
Reference in a new issue