Commit ae895075 authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

Use doseq=True when re-encoding url query parameters

The query parameters are parsed out of a string using
urlparse.parse_qs, which produces a dictionary whose values
are lists of values.

The query parameters are then stuffed back into a string
using urlencode.urlencode, which uses percent-encoding to
encode lists as literal sequences of brackets and commas,
resulting in parse_qs and urlencode not being inverse
operations.

This change adds the doseq flag to urlencode, thus making
it encode each value from the list of values as a separate
key=value pair, thus making it a true inverse of parse_qs.

R=dnj@chromium.org

Change-Id: Ic4631cc672f9e42ba371306efdda71892d625119
Reviewed-on: https://chromium-review.googlesource.com/575398Reviewed-by: 's avatarDaniel Jacques <dnj@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
parent 98681d11
......@@ -34,7 +34,7 @@ def reparse_url(parsed_url, query_params):
path=parsed_url.path,
params=parsed_url.params,
fragment=parsed_url.fragment,
query=urllib.urlencode(query_params))
query=urllib.urlencode(query_params, doseq=True))
def gitiles_get(parsed_url, handler, attempts):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment