Skip to contentSkip to conversation

fetch2: Ensure UntrustedUrl.msg is str

PATCH New Michal Sieron 1 participant 1 message Jul 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: Ensure UntrustedUrl.msg is str

After e74cfd03afe5aff1f81cbff8c6efcef77c9af618 and related commits were merged, fetchers call bb.fetch2.check_network_access() with a command, which is no longer a string, but a list. In case of untrusted URL this would now cause an exception:
Exception: TypeError: __str__ returned non-string (type list)

---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +1 -1
index 4535f55a5..a5772f8a9 100644
@@ -51,7 +51,7 @@ class UntrustedUrl(BBFetchException):
     """Exception raised when encountering a host not listed in BB_ALLOWED_NETWORKS"""
     def __init__(self, url, message=''):
         if message:
-            msg = message
+            msg = str(message)
         else:
             msg = "The URL: '%s' is not trusted and cannot be used" % url
         self.url = url

---
base-commit: 3a99c26fa581d70ed67bd08a5e0e0d0b18369a7c
change-id: 20260713-untrusted-msg-str-b54fb7f8a8d6

Best regards,

Signature · 1 line
Michal Sieron <[email protected]>