diff mbox series

fetch2: Ensure UntrustedUrl.msg is str

Message ID 20260713-untrusted-msg-str-v1-1-9496b78c39a5@gmail.com
State New
Headers show
Series fetch2: Ensure UntrustedUrl.msg is str | expand

Commit Message

Michal Sieron July 13, 2026, 4:28 p.m. UTC
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)

Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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

Best regards,
--  
Michal Sieron <michalwsieron@gmail.com>
diff mbox series

Patch

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 4535f55a5..a5772f8a9 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -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