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

ResourceHttpRequestHandler fails to resolve encoded paths when PathPattern is used #26775

Closed
philwebb opened this issue Apr 7, 2021 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Apr 7, 2021

See spring-projects/spring-boot#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.

app.zip

@philwebb
Copy link
Member Author

philwebb commented Apr 8, 2021

Uploading the full jar file which includes the nested resources jar.

app-0.0.1.jar.zip

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.

@rstoyanchev rstoyanchev self-assigned this Apr 8, 2021
@rstoyanchev rstoyanchev added this to the 5.3.6 milestone Apr 8, 2021
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 8, 2021
Zoran0104 pushed a commit to Zoran0104/spring-framework that referenced this issue Aug 20, 2021
Zoran0104 pushed a commit to Zoran0104/spring-framework that referenced this issue Aug 20, 2021
Zoran0104 pushed a commit to Zoran0104/spring-framework that referenced this issue Aug 20, 2021
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants