Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[injection] 2.3.8 broke certain regex match patterns #2670

Closed
thehesiod opened this issue Jan 17, 2018 · 4 comments
Closed

[injection] 2.3.8 broke certain regex match patterns #2670

thehesiod opened this issue Jan 17, 2018 · 4 comments
Labels

Comments

@thehesiod
Copy link
Contributor

thehesiod commented Jan 17, 2018

Long story short

#2667 causes the following scenario to break:

router.add_get('/v1/grid/{variable}/{interval_type}/{date}', get_grid)

which compiles to:

re.compile('\\/v1\\/grid\\/(?P<variable>[^{}/]+)\\/(?P<interval_type>[^{}/]+)\\/(?P<date>[^{}/]+)')

which causes the following match group:

<class 'tuple'>: ('temp', 'hourly', '2015-01-01T00:00:00%2B00:00')

and with this code that was recently modified in aiohttp:

{key: URL(value, encoded=True).path for key, value in
                    match.groupdict().items()}

yields

{'variable': 'temp', 'interval_type': 'hourly', 'date': '00:00+00:00'}

Expected behaviour

should not strip out the date from the datetime string

Actual behaviour

date is getting stripped out

Steps to reproduce

Your environment

aiohttp 2.3.8
yarl 1.0.0

@asvetlov
Copy link
Member

Reproduced.
Will make bugfix release today

@Artimi
Copy link

Artimi commented Jan 17, 2018

I've encountered the same problem. This code:

import aiohttp.web
import asyncio


async def hello(request):
	name = request.match_info['name']
	return aiohttp.web.Response(text = f'{name}')


app = aiohttp.web.Application()
app.router.add_get('/{name}', hello)

if __name__ == '__main__':
	aiohttp.web.run_app(app)

With this request:

http://0.0.0.0:8080/na:me

results in

me

Expected:

na:me

It is not problem in aiohttp 2.3.7 with yarl <1.0.0

@asvetlov
Copy link
Member

Fixed by 2.3.9 release

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants