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

[Bug] Sanic-ext breaks @app.route(unquote=True) #148

Closed
xmcp opened this issue Oct 27, 2022 · 4 comments · Fixed by #163
Closed

[Bug] Sanic-ext breaks @app.route(unquote=True) #148

xmcp opened this issue Oct 27, 2022 · 4 comments · Fixed by #163
Assignees

Comments

@xmcp
Copy link

xmcp commented Oct 27, 2022

Describe the bug
Sanic v21.3 adds the unquote arg in @app.route to url-decode parameters in routes. But when sanic-ext is loaded, parameters will not be decoded even unquote is set.

Screenshots
Not related to swagger.

To Reproduce

from sanic import Sanic
from sanic.response import text

app = Sanic("test")
#app.config.AUTO_EXTEND = False

@app.route("/<param:str>", methods=["GET"], unquote=True)
async def handler2(request, param):
    return text("OK2 " + param)

Then visit http://127.0.0.1:8000/%E5%95%8A and find that it returns OK2 %E5%95%8A.

Expected behavior
The page should return OK2 啊.

Environment (please complete the following information):

  • OS: Windows 10
  • Browser: not related
  • Version sanic==22.9.0, sanic-ext==22.9.0

Additional context
After uncommenting app.config.AUTO_EXTEND = False in the script above, sanic works as expected. So this issue is caused by sanic-ext.

@ChihweiLHBird ChihweiLHBird self-assigned this Nov 7, 2022
@ChihweiLHBird
Copy link
Member

Thanks for the issue. I am going to investigate it.

@ChihweiLHBird ChihweiLHBird removed their assignment Nov 8, 2022
@ChihweiLHBird
Copy link
Member

I found that when the app is extended, for some reason, unquote(basket['__matches__'][0]) isn't injected into the find_route method of the router.
@ahopkins Can you take a look at this issue later? Thanks!

@xmcp
Copy link
Author

xmcp commented Nov 30, 2022

Note: This issue is also reproducible on 21.12.3 which is LTS.

@ahopkins ahopkins self-assigned this Dec 21, 2022
@ahopkins
Copy link
Member

I see what the issue is. I will get a patch out for 22.12 and 21.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants