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

UrlResource getFilename should not contain query parameters [SPR-15411] #19974

spring-projects-issues opened this issue Apr 4, 2017 · 1 comment
in: core type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Apr 4, 2017

Jerome Hordies opened SPR-15411 and commented

UrlResource.getFilename uses URL.getFile() instead of URL.getPath()

The URL.getFile() javadocs say :
Gets the file name of this URL. The returned file portion will be the same as getPath(), plus the concatenation of the value of getQuery(), if any. If there is no query portion, this method and getPath() will return identical results.

This causes a bug in Spring boot when specifying --spring.config.location=http://host/group/repo/raw/branch/config.yml?private_token=NyAq4wDit3hmJ7UZPyMU because ".yml?private_token=NyAq4wDit3hmJ7UZPyMU" is not a supported extension.

My workaround until this gets fixed is to use --spring.config.location=http://host/group/repo/raw/branch/config.yml?private_token=NyAq4wDit3hmJ7UZPyMU&fake_param=whatever.yml

Affects: 3.2.18, 4.2.9, 4.3.7, 5.0 M5

Reference URL: #1372

Issue Links:

  • #19994 UnknownHostException not accepted as "resource not found" anymore
  • #21732 Be more defensive in UrlResource about cleaning the path
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 6, 2017

Juergen Hoeller commented

Thanks for raising this! I've revised UrlResource.getFilename overall, taking URL.getPath() as a starting point and then applying our StringUtils.getFilename delegate, in alignment with other Resource implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core type: bug
None yet

No branches or pull requests

2 participants