Repository navigation
fix(auth): strip trailing slash from base URL to avoid double-slash paths - #1775
Open
Waleed-thisone wants to merge 4 commits into
Open
Waleed-thisone wants to merge 4 commits into
Waleed-thisone wants to merge 4 commits into
Conversation
…aths Trim trailing slash from URL in constructor.
Author
|
Heads-up: I noticed #1766 by @hsusul tackles the same issue and was opened before this PR — I only spotted it after filing mine, sorry for the duplicate. Happy for the maintainers to merge whichever you prefer. If #1766 goes in, the regression tests in this PR (authorize URL + mocked /user request, for both the sync and async clients) could still be useful — feel free to cherry-pick them, or I can rebase them onto that change / open a tests-only PR if that's helpful. Thanks for maintaining the project! |
This branch has not been deployed
This file contains hidden or 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
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.
What kind of change does this PR introduce?
Bug fix for #1763.
What is the current behavior?
Clients constructed with an Auth base URL ending in
/(e.g.https://project.example/auth/v1/) build double-slash endpoint paths such as/auth/v1//authorizefor OAuth and/auth/v1//userfor regular requests, because the base URL is stored verbatim inGoTrueBaseAPIand paths are built asf"{self._url}/{path}".Fixes #1763
What is the new behavior?
The base URL is normalized once in
AsyncGoTrueBaseAPI.__init__(and the generated sync equivalent) by stripping any trailing slash, so every endpoint (client requests, admin API, OAuth authorize URL) is built from a clean base URL.Additional context
_syncbase API file was changed by hand to the exact lineunasyncgenerates, to avoid unrelated formatting churn./userrequest with a trailing-slash base URL.cc @silentworks for review, as suggested in CONTRIBUTING.md.