Skip to content

Commit

Permalink
Make URL secrets removal more resilient
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Sep 19, 2024
1 parent 5ce26d5 commit de72a73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dispatcher/backend/src/routes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ def remove_url_secrets(response: dict):
if not isinstance(response[key], str) or "://" not in response[key]:
continue
for url in [word for word in response[key].split() if "://" in word]:
urlparts = urlsplit(url)
try:
urlparts = urlsplit(url)
except Exception as exc:
logger.warning(

Check warning on line 109 in dispatcher/backend/src/routes/utils.py

View check run for this annotation

Codecov / codecov/patch

dispatcher/backend/src/routes/utils.py#L108-L109

Added lines #L108 - L109 were not covered by tests
f"Ignoring bad URL in remove_url_secrets: {url}", exc_info=exc
)
continue

Check warning on line 112 in dispatcher/backend/src/routes/utils.py

View check run for this annotation

Codecov / codecov/patch

dispatcher/backend/src/routes/utils.py#L112

Added line #L112 was not covered by tests
newquery = urlencode(
{
key: (
Expand Down

0 comments on commit de72a73

Please sign in to comment.