Mercurial > p > roundup > code
changeset 5503:4f6e1ce89557
always encode query parameters in sorted order
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Thu, 16 Aug 2018 20:14:09 +0100 |
| parents | 497ab896397d |
| children | 7f3dfdd6a620 |
| files | roundup/cgi/actions.py test/test_actions.py |
| diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/cgi/actions.py Thu Aug 16 19:23:14 2018 +0100 +++ b/roundup/cgi/actions.py Thu Aug 16 20:14:09 2018 +0100 @@ -1221,7 +1221,7 @@ redirect_url_tuple.netloc, redirect_url_tuple.path, redirect_url_tuple.params, - urllib_.urlencode(query, doseq=True), + urllib_.urlencode(list(sorted(query.items())), doseq=True), redirect_url_tuple.fragment) ) @@ -1239,7 +1239,7 @@ redirect_url_tuple.netloc, redirect_url_tuple.path, redirect_url_tuple.params, - urllib_.urlencode(query, doseq=True), + urllib_.urlencode(list(sorted(query.items())), doseq=True), redirect_url_tuple.fragment ) ) raise exceptions.Redirect(redirect_url)
--- a/test/test_actions.py Thu Aug 16 19:23:14 2018 +0100 +++ b/test/test_actions.py Thu Aug 16 20:14:09 2018 +0100 @@ -325,7 +325,7 @@ # test if we are logged out; should kill the @action=logout self.form.value[:] = [] # clear out last test's setup values - self.assertLoginRaisesRedirect("http://whoami.com/path/issue39?%40startwith=0&%40pagesize=50", + self.assertLoginRaisesRedirect("http://whoami.com/path/issue39?%40pagesize=50&%40startwith=0", 'foo', 'right', "http://whoami.com/path/issue39?@action=logout&@pagesize=50&@startwith=0") def testInvalidLoginRedirect(self): @@ -336,12 +336,12 @@ self.client.opendb = opendb # basic test with query - self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40error_message=Invalid+login&%40action=search", + self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search&%40error_message=Invalid+login", 'foo', 'wrong', "http://whoami.com/path/issue?@action=search") # test that old messages are removed self.form.value[:] = [] # clear out last test's setup values - self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40error_message=Invalid+login&%40action=search", + self.assertLoginRaisesRedirect("http://whoami.com/path/issue?%40action=search&%40error_message=Invalid+login", 'foo', 'wrong', "http://whoami.com/path/issue?@action=search&@ok_messagehurrah+we+win&@error_message=blam") # test when there is no __came_from specified
