-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
misc: Make backend handle URLs with trailing slash #1059
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
According to multiple FastAPI discussions [1], FastAPI only includes a built-in mechanism to redirect requests including a trailing slash, to its variation without slash, using a `307` status code. This can be an issue when certain clients do not send the same headers on the redirected request. This change adds a custom FastAPI `APIRouter`, that registers both route path variations (with and without trailing slash), while only marking the path without slash for being included in the OpenAPI schema. [1] fastapi/fastapi#7298
gantoine
approved these changes
Aug 7, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome!!
Merged
spiceratops
referenced
this pull request
in spiceratops/k8s-gitops
Aug 20, 2024
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [rommapp/romm](https://github.com/rommapp/romm) | minor | `3.3.0` -> `3.4.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>rommapp/romm (rommapp/romm)</summary> ### [`v3.4.0`](https://github.com/rommapp/romm/releases/tag/3.4.0) [Compare Source](https://github.com/rommapp/romm/compare/3.3.0...3.4.0) #### What's Changed - feat: Added link to home button by [@​zurdi15](https://github.com/zurdi15) in [https://github.com/rommapp/romm/pull/1054](https://github.com/rommapp/romm/pull/1054) - feat: Public collections by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1028](https://github.com/rommapp/romm/pull/1028) - feat: Added aditional platform icons by [@​Casuallynoted](https://github.com/Casuallynoted) in [https://github.com/rommapp/romm/pull/1038](https://github.com/rommapp/romm/pull/1038) - feat: Store and re-use last saved bios/save/state/core by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1037](https://github.com/rommapp/romm/pull/1037) - feat: Clickable filter buttons on details view by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1040](https://github.com/rommapp/romm/pull/1040) - feat: Add button to show duplicates by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1043](https://github.com/rommapp/romm/pull/1043) - fix: Scanning selected roms by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1042](https://github.com/rommapp/romm/pull/1042) - fix: Use namespaced cookie for session by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1009](https://github.com/rommapp/romm/pull/1009) - fix: Replace game-and-watch with g-and-w by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1026](https://github.com/rommapp/romm/pull/1026) - fix: Backend URL redirection logic by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1058](https://github.com/rommapp/romm/pull/1058) - fix: Enable flake8-async rules in ruff and fix warnings by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1030](https://github.com/rommapp/romm/pull/1030) - fix: Initialize context on scheduled task by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1033](https://github.com/rommapp/romm/pull/1033) - fix: Return early if IGDB finds an exact match by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1032](https://github.com/rommapp/romm/pull/1032) - fix: CSRF token issues by [@​zurdi15](https://github.com/zurdi15) in [https://github.com/rommapp/romm/pull/1057](https://github.com/rommapp/romm/pull/1057) - fix: Link from related games by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1045](https://github.com/rommapp/romm/pull/1045) - fix: Typos in frontend by [@​HellLord77](https://github.com/HellLord77) in [https://github.com/rommapp/romm/pull/1048](https://github.com/rommapp/romm/pull/1048) - fix: Firmware pagination by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1041](https://github.com/rommapp/romm/pull/1041) - fix: Multi-file download in gallery view by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1044](https://github.com/rommapp/romm/pull/1044) - fix: Remove persistent overlay prevents back navigation by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1036](https://github.com/rommapp/romm/pull/1036) - misc: Add Redis async cache by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1010](https://github.com/rommapp/romm/pull/1010) - misc: Create config.batocera-retrobat.yml by [@​TyroneSlothrop](https://github.com/TyroneSlothrop) in [https://github.com/rommapp/romm/pull/1013](https://github.com/rommapp/romm/pull/1013) - misc: Migrate MobyGamesHandler to async by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1011](https://github.com/rommapp/romm/pull/1011) - misc: Migrate filesystem resource handler to async by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1017](https://github.com/rommapp/romm/pull/1017) - misc: Replace pytest-vcr dependency with pytest-recording by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1021](https://github.com/rommapp/romm/pull/1021) - misc: Refactor scan process by splitting single function by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1024](https://github.com/rommapp/romm/pull/1024) - misc: Migrate IGDBBaseHandler to async by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1023](https://github.com/rommapp/romm/pull/1023) - misc: Use PYTEST_VERSION variable to detect Pytest runs by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1034](https://github.com/rommapp/romm/pull/1034) - misc: Use async interface for stream-zip by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1035](https://github.com/rommapp/romm/pull/1035) - misc: Add workflow that runs typecheck on PRs by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1055](https://github.com/rommapp/romm/pull/1055) - misc: Make backend handle URLs with trailing slash by [@​adamantike](https://github.com/adamantike) in [https://github.com/rommapp/romm/pull/1059](https://github.com/rommapp/romm/pull/1059) - misc: Drop ROMM_AUTH_USERNAME and ROMM_AUTH_PASSWORD env variables by [@​gantoine](https://github.com/gantoine) in [https://github.com/rommapp/romm/pull/1060](https://github.com/rommapp/romm/pull/1060) #### New Contributors - [@​TyroneSlothrop](https://github.com/TyroneSlothrop) made their first contribution in [https://github.com/rommapp/romm/pull/1013](https://github.com/rommapp/romm/pull/1013) **Full Changelog**: rommapp/romm@3.3.0...3.4.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yMS4zIiwidXBkYXRlZEluVmVyIjoiMzguMjEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUvY29udGFpbmVyIiwidHlwZS9taW5vciJdfQ==-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to multiple FastAPI discussions [1], FastAPI only includes a built-in mechanism to redirect requests including a trailing slash, to its variation without slash, using a
307
status code.This can be an issue when certain clients do not send the same headers on the redirected request.
This change adds a custom FastAPI
APIRouter
, that registers both route path variations (with and without trailing slash), while only marking the path without slash for being included in the OpenAPI schema.[1] fastapi/fastapi#7298