fix: handle URL encoded paths in AppOverrideFilter #20009
Merged
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.
Summary
The
AppOverrideFilter
was incorrectly handling paths containing URL encoded characters (like spaces encoded as %20) by extracting the "raw" encoded URL with therequest.getRequestURI()
method. This caused issues with file paths containing spaces, such as font files (e.g. "Open Sans Regular").The fix simplifies the path handling by using
request.getPathInfo()
which provides the correct decoded path after the servlet mapping part of the URL. This ensures proper handling of paths containing spaces and other URL encoded characters, while also being more maintainable by using the standard Servlet API as intended.Manual test:
http://localhost:8080/dhis-web-maps/fonts/Open Sans Bold/6144-6399.pbf
(double check on the file system that this path actually exist in the installed/overridden app folder, the .pdf file names can vary)http://localhost:8080/dhis-web-maps/fonts/Open Sans Bold/6144-6399.pbf
(make sure it actually exists on file system first, the .pbf files can vary from map app version)TIP: The file system path for installed apps looks similar to this:
DHIS2_HOME_FOLDER/files/apps/maps_101.0.1/fonts/Open Sans Bold