Check that attachment is a list

main
Bob Mottram 2023-11-29 10:58:48 +00:00
parent b43e7fc8cd
commit 5cd720c77f
11 changed files with 22 additions and 0 deletions

View File

@ -17,6 +17,8 @@ def get_briar_address(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):

View File

@ -17,6 +17,8 @@ def get_cwtch_address(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):

View File

@ -35,6 +35,8 @@ def get_donation_url(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
donation_type = _get_donation_types()
for property_value in actor_json['attachment']:
name_value = None

View File

@ -17,6 +17,8 @@ def get_enigma_pub_key(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):

2
git.py
View File

@ -230,6 +230,8 @@ def get_repo_url(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
repo_type = ('github', 'gitlab', 'codeberg', 'launchpad',
'sourceforge', 'bitbucket', 'gitea')
for property_value in actor_json['attachment']:

View File

@ -17,6 +17,8 @@ def get_matrix_address(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):

2
pgp.py
View File

@ -39,6 +39,8 @@ def get_email_address(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):

View File

@ -2265,6 +2265,8 @@ def actor_attached_shares(actor_json: {}) -> []:
"""
if not actor_json.get('attachment'):
return []
if not isinstance(actor_json['attachment'], list):
return []
attached_shares = []
for attach_item in actor_json['attachment']:

2
ssb.py
View File

@ -17,6 +17,8 @@ def get_ssb_address(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):

2
tox.py
View File

@ -17,6 +17,8 @@ def get_tox_address(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):

View File

@ -17,6 +17,8 @@ def get_xmpp_address(actor_json: {}) -> str:
"""
if not actor_json.get('attachment'):
return ''
if not isinstance(actor_json['attachment'], list):
return ''
for property_value in actor_json['attachment']:
name_value = None
if property_value.get('name'):