Always download the actor when checking validity, because the actor's fields may have changed

merge-requests/30/head
Bob Mottram 2022-03-13 12:40:09 +00:00
parent b932423a25
commit b676a15f77
1 changed files with 11 additions and 16 deletions

View File

@ -1687,17 +1687,13 @@ def valid_sending_actor(session, base_dir: str,
if sending_actor.endswith(domain + '/users/' + nickname): if sending_actor.endswith(domain + '/users/' + nickname):
return True return True
# get their actor # download the actor
actor_json = \ # NOTE: the actor should not be obtained from the local cache,
get_person_from_cache(base_dir, sending_actor, person_cache, True) # because they may have changed fields which are being tested here,
downloaded_actor = False # such as the bio length
if not actor_json: actor_json, _ = get_actor_json(domain, sending_actor,
# download the actor True, False, debug, True,
actor_json, _ = get_actor_json(domain, sending_actor, signing_priv_key_pem, session)
True, False, debug, True,
signing_priv_key_pem, session)
if actor_json:
downloaded_actor = True
if not actor_json: if not actor_json:
# if the actor couldn't be obtained then proceed anyway # if the actor couldn't be obtained then proceed anyway
return True return True
@ -1776,9 +1772,8 @@ def valid_sending_actor(session, base_dir: str,
sending_actor) sending_actor)
return False return False
if downloaded_actor: # if the actor is valid and was downloaded then
# if the actor is valid and was downloaded then # store it in the cache, but don't write it to file
# store it in the cache, but don't write it to file store_person_in_cache(base_dir, sending_actor, actor_json,
store_person_in_cache(base_dir, sending_actor, actor_json, person_cache, False)
person_cache, False)
return True return True