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: uvicorn>=0.26 introduces a breaking change with --root-path and path parameter #3041

Closed
1 of 4 tasks
smithk86 opened this issue Jan 28, 2024 · 3 comments · Fixed by #3039
Closed
1 of 4 tasks
Labels
Bug 🐛 This is something that is not working as expected High Priority This is a high priority

Comments

@smithk86
Copy link
Contributor

smithk86 commented Jan 28, 2024

Description

Once Uvicorn is upgraded to v0.26 or beyond, any path parameters type gets the value of --root-path prepended to them.

URL to code causing the issue

No response

MCVE

from pathlib import Path

from litestar import Litestar
from litestar.handlers import get

@get(path=["/", "/{path:path}"], sync_to_thread=False)
def pathfinder(path: Path | None) -> str:
    return f"path: {path}"

app = Litestar(route_handlers=[pathfinder], debug=True)

Steps to reproduce

Uvicorn <0.26:
1. uvicorn mcve:app --root-path /test
2. curl http://localhost:8000/myPath -> "path: /myPath"

Uvicorn >=0.26:
1. uvicorn mcve:app --root-path /test
2. curl http://localhost:8000/myPath -> "path: /test/myPath"

Screenshots

No response

Logs

No response

Litestar Version

2.5.2

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Note

While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.
Fund with Polar
@smithk86 smithk86 added the Bug 🐛 This is something that is not working as expected label Jan 28, 2024
@provinzkraut
Copy link
Member

Related to #2998.

Copy link

This issue has been closed in #3039. The change will be included in the upcoming patch release.

Copy link

A fix for this issue has been released in v2.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 This is something that is not working as expected High Priority This is a high priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants