Message ID | 20250718144337.82440-1-pamathieu@poum.ca |
---|---|
State | New |
Headers | show |
Series | [v2] fetch2/wget: Keep query parameters in URL during checkstatus | expand |
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
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 7e43d3bc97..4d19e2134b 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -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
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. CC: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Philippe-Alexandre Mathieu <pamathieu@poum.ca> --- bitbake/lib/bb/fetch2/wget.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)