Handle none values for i2p and onion domains

main
Bob Mottram 2022-03-13 15:27:04 +00:00
parent fc9aacbb1a
commit ee238d9890
1 changed files with 12 additions and 6 deletions

View File

@ -787,9 +787,12 @@ def _receive_undo_follow(session, base_dir: str, http_prefix: str,
return False return False
domain_following, port_following = \ domain_following, port_following = \
get_domain_from_actor(message_json['object']['object']) get_domain_from_actor(message_json['object']['object'])
if domain_following.endswith(onion_domain) or \ if onion_domain:
domain_following.endswith(i2p_domain): if domain_following.endswith(onion_domain):
domain_following = domain domain_following = domain
if i2p_domain:
if domain_following.endswith(i2p_domain):
domain_following = domain
domain_following_full = get_full_domain(domain_following, port_following) domain_following_full = get_full_domain(domain_following, port_following)
group_account = \ group_account = \
@ -3980,9 +3983,12 @@ def _receive_follow_request(session, session_onion, session_i2p,
return False return False
domain_to_follow, temp_port = get_domain_from_actor(message_json['object']) domain_to_follow, temp_port = get_domain_from_actor(message_json['object'])
# switch to the local domain rather than its onion or i2p version # switch to the local domain rather than its onion or i2p version
if domain_to_follow.endswith(onion_domain) or \ if onion_domain:
domain_to_follow.endswith(i2p_domain): if domain_to_follow.endswith(onion_domain):
domain_to_follow = curr_domain domain_to_follow = curr_domain
if i2p_domain:
if domain_to_follow.endswith(i2p_domain):
domain_to_follow = curr_domain
if not domain_permitted(domain_to_follow, federation_list): if not domain_permitted(domain_to_follow, federation_list):
if debug: if debug:
print('DEBUG: follow domain not permitted ' + domain_to_follow) print('DEBUG: follow domain not permitted ' + domain_to_follow)