Skip to content

Commit

Permalink
Do not unquote in match_info values #1816
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Apr 27, 2017
1 parent 2e2af6a commit 6d6f222
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Changes

- Fix assertion errors in Python 3.4 from noop helper. #1847

- Do not unquote `+` in match_info values #1816


2.0.7 (2017-04-12)
------------------
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/web_urldispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def _match(self, path):
if match is None:
return None
else:
return {key: unquote(value) for key, value in
return {key: unquote(value, unsafe='+') for key, value in
match.groupdict().items()}

def get_info(self):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_urldispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,16 @@ def test_regular_match_info(router):
repr(match_info))


@asyncio.coroutine
def test_match_info_with_plus(router):
handler = make_handler()
router.add_route('GET', '/get/{version}', handler)

req = make_request('GET', '/get/1.0+test')
match_info = yield from router.resolve(req)
assert {'version': '1.0+test'} == match_info


@asyncio.coroutine
def test_not_found_repr(router):
req = make_request('POST', '/path/to')
Expand Down

0 comments on commit 6d6f222

Please sign in to comment.