Skip to content

Commit 7119d30

Browse files
Create safe URL by dropping the auth part of the netloc
1 parent 66a107f commit 7119d30

File tree

1 file changed

+1
-5
lines changed
  • util/opentelemetry-util-http/src/opentelemetry/util/http

1 file changed

+1
-5
lines changed

util/opentelemetry-util-http/src/opentelemetry/util/http/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ def remove_url_credentials(url: str) -> str:
166166
parsed = urlparse(url)
167167
if all([parsed.scheme, parsed.netloc]): # checks for valid url
168168
parsed_url = urlparse(url)
169-
netloc = (
170-
(":".join(((parsed_url.hostname or ""), str(parsed_url.port))))
171-
if parsed_url.port
172-
else (parsed_url.hostname or "")
173-
)
169+
_, _, netloc = parsed.netloc.rpartition("@")
174170
return urlunparse(
175171
(
176172
parsed_url.scheme,

0 commit comments

Comments
 (0)