keep path after removing port from URL

This commit is contained in:
ophirharpazg 2020-09-02 00:17:02 +03:00
parent 0d71e22b08
commit eb4f50a0ca
1 changed files with 1 additions and 1 deletions

View File

@ -16,5 +16,5 @@ def get_host_from_network_location(network_location: str) -> str:
def remove_port(url): def remove_port(url):
parsed = urlparse(url) parsed = urlparse(url)
with_port = f'{parsed.scheme}://{parsed.netloc}' with_port = f'{parsed.scheme}://{parsed.netloc}'
without_port = re.sub(':[0-9]+$', '', with_port) without_port = re.sub(':[0-9]+(?=$|\/)', '', with_port)
return without_port return without_port