Skip to content

Make frontend.url parsing lenient when trailing slash is missing#11972

Open
VarshiniGunti wants to merge 3 commits intocBioPortal:masterfrom
VarshiniGunti:fix-frontend-url-trailing-slash-10540
Open

Make frontend.url parsing lenient when trailing slash is missing#11972
VarshiniGunti wants to merge 3 commits intocBioPortal:masterfrom
VarshiniGunti:fix-frontend-url-trailing-slash-10540

Conversation

@VarshiniGunti
Copy link

Fix #10540

Describe changes proposed in this pull request:

  • Normalize frontend.url in FrontendPropertiesServiceImpl.getFrontendUrl(...) by routing the non-runtime path through parseUrl(...).
  • This adds a trailing slash when missing (and trims whitespace), preventing broken frontend asset URLs when frontend.url is configured without /.
  • Keep existing frontend.url.runtime behavior, while also normalizing the runtime file value.
  • Add unit tests in FrontendPropertiesServiceImplTest for:
    • missing trailing slash
    • whitespace trimming
    • null/empty input
    • runtime override normalization

Checks

Any screenshots or GIFs?

  • Not applicable (backend/config normalization change, no visual/UI change).

Notify reviewers

I checked history for the touched files and will request review from maintainers familiar with:

  • src/main/java/org/cbioportal/legacy/service/FrontendPropertiesServiceImpl.java
  • src/test/java/org/cbioportal/legacy/service/FrontendPropertiesServiceImplTest.java

Local validation:

  • mvn -Dtest=FrontendPropertiesServiceImplTest test passed on JDK 21.
  • Full mvn test in this local environment has unrelated repository/integration-style failures (ClickHouse/MyBatis test classes), so this PR scopes validation to the targeted unit tests for changed behavior.

@VarshiniGunti
Copy link
Author

Hi maintainers👋

Just to clarify on the CI status:

  • The added unit tests (FrontendPropertiesServiceImplTest) pass locally on JDK 21 and in CI.
  • The failing jobs appear to be Docker/image build workflows that require maintainer approval for forked PRs.

Happy to rebase/squash or adjust anything if needed.
Please let me know if you’d like me to make any changes on my side , otherwise I believe this is ready for review.

Thanks!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #10540 by making the frontend.url configuration parameter more lenient. When the trailing slash is missing from frontend.url, it previously caused broken frontend asset URLs. The fix normalizes the URL by routing it through the existing parseUrl() method, which trims whitespace and adds a trailing slash if missing. This normalization is now applied to both the regular frontend.url property value and the runtime override file value.

Changes:

  • Modified getFrontendUrl() to normalize the property value by calling parseUrl() before returning
  • Added comprehensive unit tests for URL normalization (missing slash, whitespace trimming, null/empty inputs, runtime override)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/main/java/org/cbioportal/legacy/service/FrontendPropertiesServiceImpl.java Changed return statement in getFrontendUrl() to normalize the property value through parseUrl()
src/test/java/org/cbioportal/legacy/service/FrontendPropertiesServiceImplTest.java Added new test file with comprehensive tests for parseUrl() and getFrontendUrl() methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make frontend.url parameter more lenient

2 participants