do not lose query string for whole URL replacement (#4643)

This commit is contained in:
Frédéric Péters 2014-04-04 19:26:30 +02:00
parent 2731bda86c
commit bfd0f63020
2 changed files with 5 additions and 1 deletions

View File

@ -75,3 +75,7 @@ def test_url_server_even_more():
def test_url_server_even_more_more():
assert get_variadic_url('[url]/foobar/baz/json?foo=bar',
{'url': 'http://www.example.net'}) == 'http://www.example.net/foobar/baz/json?foo=bar'
def test_url_whole_with_qs():
assert get_variadic_url('[url]',
{'url': 'http://www.example.net/?foo=bar'}) == 'http://www.example.net/?foo=bar'

View File

@ -468,7 +468,7 @@ def get_variadic_url(url, variables, encode_query=True):
p2 = urlparse.urlsplit(before_path)
scheme, netloc = p2.scheme, p2.netloc
if p2.path and not path:
path = p2.path
path, query = p2.path, p2.query
if path:
path = quote(ezt_substitute(path, variables))
if fragment and '[' in fragment: