Skip to content

Commit

Permalink
Create safe URL by dropping the auth part of the netloc
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-hutchinson committed May 24, 2024
1 parent 66a107f commit 7119d30
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,7 @@ def remove_url_credentials(url: str) -> str:
parsed = urlparse(url)
if all([parsed.scheme, parsed.netloc]): # checks for valid url
parsed_url = urlparse(url)
netloc = (
(":".join(((parsed_url.hostname or ""), str(parsed_url.port))))
if parsed_url.port
else (parsed_url.hostname or "")
)
_, _, netloc = parsed.netloc.rpartition("@")
return urlunparse(
(
parsed_url.scheme,
Expand Down

0 comments on commit 7119d30

Please sign in to comment.