This repository was archived by the owner on Dec 20, 2025. It is now read-only.
fix(retrofit2): fix multiple slash issue in baseUrl of retrofit2 client#1206
Merged
mergify[bot] merged 4 commits intospinnaker:masterfrom Mar 22, 2025
Merged
Conversation
…e baseUrl of the Github client has multiple slashes and the end point start with a slash
…has multiple slashes and the end point start with a slash, the resultant api url leaves that part the base url coming after first slash.
…e to fix any issues that may occur if the base url has multiple slashes
…louddriverApi and Front50Api to fix any issues that may occur if the base url has multiple slashes
dbyron-sf
reviewed
Mar 22, 2025
|
|
||
| import okhttp3.HttpUrl; | ||
|
|
||
| public class RetrofitUtils { |
Contributor
There was a problem hiding this comment.
Seems like this belongs in kork. We've got copies of this sprinkled around a few repos, right? Happy to get these fixes in for now, but let's plan to centralize.
dbyron-sf
approved these changes
Mar 22, 2025
Contributor
|
@Mergifyio backport release-1.37.x |
Contributor
✅ Backports have been createdDetails
|
mergify bot
pushed a commit
that referenced
this pull request
Mar 22, 2025
…nt (#1206) * test(github): add a test to demonstrate an error scenario where if the baseUrl of the Github client has multiple slashes and the end point start with a slash * fix(github): fix the error where if the baseUrl of the Github client has multiple slashes and the end point start with a slash, the resultant api url leaves that part the base url coming after first slash. * refactor(api): refactor retrofit2 client configuration for FiatService to fix any issues that may occur if the base url has multiple slashes * refactor(web): refactor retrofit2 client configuration for IgorApi, ClouddriverApi and Front50Api to fix any issues that may occur if the base url has multiple slashes (cherry picked from commit a7f7f9d)
mergify bot
added a commit
that referenced
this pull request
Mar 22, 2025
…nt (#1206) (#1207) * test(github): add a test to demonstrate an error scenario where if the baseUrl of the Github client has multiple slashes and the end point start with a slash * fix(github): fix the error where if the baseUrl of the Github client has multiple slashes and the end point start with a slash, the resultant api url leaves that part the base url coming after first slash. * refactor(api): refactor retrofit2 client configuration for FiatService to fix any issues that may occur if the base url has multiple slashes * refactor(web): refactor retrofit2 client configuration for IgorApi, ClouddriverApi and Front50Api to fix any issues that may occur if the base url has multiple slashes (cherry picked from commit a7f7f9d) Co-authored-by: Kiran Godishala <53332225+kirangodishala@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When a retrofit client baseUrl has multiple slashes(ex:
https://somehost/api/v3/), the resulting url changes based on the whether there is a leading slash in the endpoint or not. If the endpoint is prefixed with a/(ex:/orgs/{org}/members) the resulting url omits the segment post first/from baseUrl.The example above results in
https://somehost/orgs/someorg/membersinstead ofhttps://somehost/api/v3/orgs/someorg/members.This PR addresses the issue by removing the leading
/from all the endpoints and making sure the baseUrl ends with a trailing/A test is added to demonstrate the issue.