From 4c057f006929dc666f4542eeaa4ddc9c0b797ca4 Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Tue, 14 Nov 2023 12:23:29 +0000 Subject: [PATCH] Use doseq=True when re-encoding query params in set_query_params Otherwise, the list of values will be stringified and then URL encoded, resulting in something like locale=%5B%27en%27%5D From parse_qs docs: Use the urllib.parse.urlencode() function (with the doseq parameter set to True) to convert such dictionaries into query strings. --- wagtail/admin/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wagtail/admin/utils.py b/wagtail/admin/utils.py index 4ba915b286..134ed177e5 100644 --- a/wagtail/admin/utils.py +++ b/wagtail/admin/utils.py @@ -68,5 +68,5 @@ def set_query_params(url: str, params: dict): querydict = parse_qs(query) querydict.update(params) querydict = {key: value for key, value in querydict.items() if value is not None} - query = urlencode(querydict) + query = urlencode(querydict, doseq=True) return urlunsplit((scheme, netloc, path, query, fragment))