From 3b3f87cfd878572010c495c4b9378733ebe206d9 Mon Sep 17 00:00:00 2001 From: benoit74 Date: Thu, 19 Sep 2024 12:59:09 +0000 Subject: [PATCH] Make URL secrets removal more resilient --- dispatcher/backend/src/routes/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dispatcher/backend/src/routes/utils.py b/dispatcher/backend/src/routes/utils.py index 41491fd2..ee5d1145 100644 --- a/dispatcher/backend/src/routes/utils.py +++ b/dispatcher/backend/src/routes/utils.py @@ -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( + f"Ignoring bad URL in remove_url_secrets: {url}", exc_info=exc + ) + continue newquery = urlencode( { key: (