Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Redirect should have correct location header [DHIS2-18185] (2.41) #20067

Merged
merged 7 commits into from
Feb 25, 2025

Conversation

david-mackessy
Copy link
Contributor

@david-mackessy david-mackessy commented Feb 25, 2025

Issue

When a redirect is returned, the URL is having a / stripped out when it shouldn't.
E.g. http://localhost:8080/api/apps/line-listing/ is being returned as http:/localhost:8080/api/apps/line-listing/

Cause

When the forward slash cleaning is done, it is removing an extra slash from http:// to http:/
Because there are no guarantees about the strings and formatting being used currently, it is required to manually add / in several places to make sure to hopefully end up with a correct URL.

Fix

Extract the base url first & remove any trailing slash from it, so we know that whatever string is added afterwards, it should be ok to clean.

Created a util method as this kind of pattern is used in multiple places (these places have also been updated as a matter of safety). This should help keep uniformity and reduce issues.

Testing

Automated

E2E test added
Unit tests added for new util method to help ensure correct URL format is sent.

Manual

Manually tested locally

Copy link

sonarqubecloud bot commented Feb 25, 2025

@david-mackessy david-mackessy merged commit 1725e44 into 2.41 Feb 25, 2025
15 checks passed
@david-mackessy david-mackessy deleted the DHIS2-18185_2.41_2 branch February 25, 2025 15:23
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.

3 participants