Skip to contentSkip to conversation

fetch2/wget: Keep query parameters in URL during checkstatus

PATCH In review Philippe-Alexandre Mathieu 1 participant 2 messages Jul 18, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fetch2/wget: Keep query parameters in URL during checkstatus

When recreating the uri in wget's checkstatus method, we only use the scheme, netloc and path. This completely strips the query parameters from the final URI and potentially breaks the checking functionality from certain fetchers.

This is the case for the Azure storage fetcher, as it requires a SAS token that is formatted as a series of query parameters. The error manifests itself when using a private storage account as a PREMIRROR or SSTATE_MIRROR (since regular SRC_URI won't run the checkstatus).

This problem is present in scarthgap, but wasn't in kirkstone.

---
 bitbake/lib/bb/fetch2/wget.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/wget.py +4 -1
index 7e43d3bc97..4d19e2134b 100644
@@ -372,7 +372,10 @@ class Wget(FetchMethod):
 
             try:
                 parts = urllib.parse.urlparse(ud.url.split(";")[0])
-                uri = "{}://{}{}".format(parts.scheme, parts.netloc, parts.path)
+                if parts.query:
+                    uri = "{}://{}{}?{}".format(parts.scheme, parts.netloc, parts.path, parts.query)
+                else:
+                    uri = "{}://{}{}".format(parts.scheme, parts.netloc, parts.path)
                 r = urllib.request.Request(uri)
                 r.get_method = lambda: "HEAD"
                 # Some servers (FusionForge, as used on Alioth) require that the
Signature · 1 line
2.39.5
#1 lore raw

I accidentally overwrote the changelog from my patch, here it is again:
changes in v2: check if url contains query parameters; v1 would erroneously add a trailing question mark for URLs without a query