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

UriUtils.extractFileExtension() does not properly handle all fragments [SPR-15786] #20341

Closed
spring-projects-issues opened this issue Jul 18, 2017 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 18, 2017

Takuya Iwatsuka opened SPR-15786 and commented

UriUtils.extractFileExtension() returns incorrect result when meet both conditions shown below.

  • input path does not include query strings
  • input path includes a path fragment and the fragment contains "?"
UriUtils.extractFileExtension("/xxx/yyy.json#aaa?bbb"); // => "json#aaa"

In addition, it might return extension-like string if the fragment contains "." before "?".

UriUtils.extractFileExtension("/xxx/yyy.json#aaa.xml?bbb"); // => "xml"

According to RFC 3986, both "." and "?" could be contained in path fragments.
It is expected that the method handle these inputs correctly.


Affects: 4.3.9

Issue Links:

Referenced from: pull request #1480, and commits 40b4276, 13080f0

@spring-projects-issues
Copy link
Collaborator Author

Med Belamachi commented

I have created a pull request to fixe this issue.
#1480

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I've ended up resolving this in a slightly different implementation style but kept using your unit tests. Thanks for the pull request, in any case!

@spring-projects-issues
Copy link
Collaborator Author

Med Belamachi commented

Yes I see,the idea still the same ;)
Thanks for keeping my unit tests !

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

2 participants