Check that path exists

merge-requests/30/head
Bob Mottram 2024-09-28 17:48:09 +01:00
parent 0af6b09840
commit 0df15cca0e
2 changed files with 5 additions and 0 deletions

View File

@ -6154,9 +6154,11 @@ def download_announce(session, base_dir: str, http_prefix: str,
base_dir, nickname, domain, post_id, base_dir, nickname, domain, post_id,
recent_posts_cache) recent_posts_cache)
return None return None
announced_actor = announced_json['id'] announced_actor = announced_json['id']
if announced_json.get('attributedTo'): if announced_json.get('attributedTo'):
announced_actor = get_attributed_to(announced_json['attributedTo']) announced_actor = get_attributed_to(announced_json['attributedTo'])
if not announced_json.get('type'): if not announced_json.get('type'):
print('WARN: announced post does not have a type ' + print('WARN: announced post does not have a type ' +
str(announced_json)) str(announced_json))

View File

@ -745,6 +745,9 @@ def get_locked_account(actor_json: {}) -> bool:
def has_users_path(path_str: str) -> bool: def has_users_path(path_str: str) -> bool:
"""Whether there is a /users/ path (or equivalent) in the given string """Whether there is a /users/ path (or equivalent) in the given string
""" """
if not path_str:
return False
users_list = get_user_paths() users_list = get_user_paths()
for users_str in users_list: for users_str in users_list:
if users_str in path_str: if users_str in path_str: