mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing URL munging when the url includes a non key=value pair in the query string. Ex: https://cns.utoronto.ca/~cks/space/blog/?atom. Thanks to @firesock for finding this.
This commit is contained in:
parent
5023a7fafe
commit
79b3872e1e
1 changed files with 6 additions and 2 deletions
|
@ -61,9 +61,13 @@ def utf8encode(tstr):
|
|||
def append_query_string_to_url(url, **kwargs):
|
||||
url_parts = list(urlparse.urlparse(url))
|
||||
query = dict(urlparse.parse_qsl(url_parts[4]))
|
||||
query.update(kwargs)
|
||||
|
||||
url_parts[4] = urllib.urlencode(query)
|
||||
if not url_parts[4] or (url_parts[4] and len(query.keys())):
|
||||
# Ensure query string is preserved.
|
||||
# ?atom should be preserved, so ignore
|
||||
# ?feed=atom is fine
|
||||
query.update(kwargs)
|
||||
url_parts[4] = urllib.urlencode(query)
|
||||
|
||||
return urlparse.urlunparse(url_parts)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue