mirror of https://gitlab.com/bashrc2/epicyon
More robust checking for icon url
parent
60b50bf7ff
commit
f62ab70c2b
10
posts.py
10
posts.py
|
@ -411,9 +411,13 @@ def get_person_box(signing_priv_key_pem: str, origin_domain: str,
|
||||||
shared_inbox = person_json['endpoints']['sharedInbox']
|
shared_inbox = person_json['endpoints']['sharedInbox']
|
||||||
avatar_url = None
|
avatar_url = None
|
||||||
if person_json.get('icon'):
|
if person_json.get('icon'):
|
||||||
if isinstance(person_json['icon'], dict):
|
icon_dict = person_json['icon']
|
||||||
if person_json['icon'].get('url'):
|
if isinstance(icon_dict, list):
|
||||||
url_str = get_url_from_post(person_json['icon']['url'])
|
if len(icon_dict) > 0:
|
||||||
|
icon_dict = icon_dict[0]
|
||||||
|
if isinstance(icon_dict, dict):
|
||||||
|
if icon_dict.get('url'):
|
||||||
|
url_str = get_url_from_post(icon_dict['url'])
|
||||||
avatar_url = remove_html(url_str)
|
avatar_url = remove_html(url_str)
|
||||||
display_name = None
|
display_name = None
|
||||||
possible_display_name = None
|
possible_display_name = None
|
||||||
|
|
|
@ -278,9 +278,13 @@ def html_profile_after_search(authorized: bool,
|
||||||
|
|
||||||
avatar_url = ''
|
avatar_url = ''
|
||||||
if profile_json.get('icon'):
|
if profile_json.get('icon'):
|
||||||
if isinstance(profile_json['icon'], dict):
|
icon_dict = profile_json['icon']
|
||||||
if profile_json['icon'].get('url'):
|
if isinstance(icon_dict, list):
|
||||||
url_str = get_url_from_post(profile_json['icon']['url'])
|
if len(icon_dict) > 0:
|
||||||
|
icon_dict = icon_dict[0]
|
||||||
|
if isinstance(icon_dict, dict):
|
||||||
|
if icon_dict.get('url'):
|
||||||
|
url_str = get_url_from_post(icon_dict['url'])
|
||||||
avatar_url = remove_html(url_str)
|
avatar_url = remove_html(url_str)
|
||||||
if not avatar_url:
|
if not avatar_url:
|
||||||
avatar_url = get_person_avatar_url(base_dir, person_url, person_cache)
|
avatar_url = get_person_avatar_url(base_dir, person_url, person_cache)
|
||||||
|
|
Loading…
Reference in New Issue