Make frontend.url parsing lenient when trailing slash is missing#11972
Make frontend.url parsing lenient when trailing slash is missing#11972VarshiniGunti wants to merge 3 commits intocBioPortal:masterfrom
Conversation
|
Hi maintainers👋 Just to clarify on the CI status:
Happy to rebase/squash or adjust anything if needed. Thanks! |
There was a problem hiding this comment.
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 callingparseUrl()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.
Fix #10540
Describe changes proposed in this pull request:
frontend.urlinFrontendPropertiesServiceImpl.getFrontendUrl(...)by routing the non-runtime path throughparseUrl(...).frontend.urlis configured without/.frontend.url.runtimebehavior, while also normalizing the runtime file value.FrontendPropertiesServiceImplTestfor:Checks
Any screenshots or GIFs?
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.javasrc/test/java/org/cbioportal/legacy/service/FrontendPropertiesServiceImplTest.javaLocal validation:
mvn -Dtest=FrontendPropertiesServiceImplTest testpassed on JDK 21.mvn testin 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.