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-issuemaster opened this issue Jul 18, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

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:

  • #19048 Avoid dependency on WebUtils for extracting file extension

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

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 18, 2017

Med Belamachi commented

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

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 19, 2017

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 19, 2017

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
You can’t perform that action at this time.