Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.

Comments

fix(retrofit2): fix multiple slash issue in baseUrl of retrofit2 client#1206

Merged
mergify[bot] merged 4 commits intospinnaker:masterfrom
kirangodishala:fix-double-slash-issue
Mar 22, 2025
Merged

fix(retrofit2): fix multiple slash issue in baseUrl of retrofit2 client#1206
mergify[bot] merged 4 commits intospinnaker:masterfrom
kirangodishala:fix-double-slash-issue

Conversation

@kirangodishala
Copy link
Contributor

@kirangodishala kirangodishala commented Mar 22, 2025

  • 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/members instead of https://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.

…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

import okhttp3.HttpUrl;

public class RetrofitUtils {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 dbyron-sf added the ready to merge Approved and ready for merge label Mar 22, 2025
@mergify mergify bot added the auto merged label Mar 22, 2025
@mergify mergify bot merged commit a7f7f9d into spinnaker:master Mar 22, 2025
5 checks passed
@dbyron-sf
Copy link
Contributor

@Mergifyio backport release-1.37.x

@mergify
Copy link
Contributor

mergify bot commented Mar 22, 2025

backport release-1.37.x

✅ Backports have been created

Details

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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants