See https://github.com/spring-projects/spring-boot/issues/24805 and #26445
When working with the classic ant path matcher ResourceHttpRequestHandler
will resolve resources in folders that have encoded characters. When switching to PathPattern
, this fails.
The reason appears to a difference with the value stored in HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
. With the ant matcher this line returns a path that's decoded. With the PathPattern
it returns to original encoded form.
The attached application will replicate the issue. Calling curl http://localhost:8080/nested-reserved-%21%23%24%25%26%28%29%2A%2B%2C%3A%3D%3F%40%5B%5D-meta-inf-resource.txt
will work if ant-path-matcher
is set in the application.yml
but fail when it's path-pattern-parser
.
Comment From: philwebb
Uploading the full jar file which includes the nested resources jar.
The original app is from https://github.com/spring-projects/spring-boot/blob/master/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/com/example/ResourceHandlingApplication.java and is updated dynamically as we test a number of different servlet containers.