Protocol handler can have path after domain

main
Bob Mottram 2023-01-10 14:09:35 +00:00
parent f6ca746c19
commit 63ee0e0c54
1 changed files with 7 additions and 4 deletions

View File

@ -277,13 +277,16 @@ def wellknown_protocol_handler(path: str, base_dir: str,
handle = handle[1:] handle = handle[1:]
if '@' in handle: if '@' in handle:
nickname = handle.split('@')[0] nickname = handle.split('@')[0]
domain = handle.split('@')[1] domain_and_path = handle.split('@')[1]
else: else:
nickname = handle nickname = handle
domain = domain_full domain_and_path = domain_full
# not an open redirect # not an open redirect
if domain == domain_full: if domain_and_path.startswith(domain_full):
return http_prefix + '://' + domain_full + '/users/' + nickname domain_length = len(domain_full)
path_str = domain_and_path[domain_length:]
return http_prefix + '://' + domain_full + \
'/users/' + nickname + path_str
return None return None