Skip to content

SPR-15411: Avoid query parameters in filename - #1372

Closed
jhordies wants to merge 1 commit into
spring-projects:masterfrom
jhordies:patch-1
Closed

jhordies wants to merge 1 commit into
spring-projects:masterfrom
jhordies:patch-1

Conversation

@jhordies

@jhordies jhordies commented Apr 4, 2017 •

Copy link
Copy Markdown

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

https://jira.spring.io/browse/SPR-15411

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

Copy link
Copy Markdown

@jhordies Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster

Copy link
Copy Markdown

@jhordies Thank you for signing the Contributor License Agreement!

@jhordies jhordies changed the title Fix: Avoid query parameters in filename SPR-15411: Avoid query parameters in filename Apr 4, 2017
@jhoeller

jhoeller commented Apr 6, 2017

Copy link
Copy Markdown
Contributor

Thanks for the pull request! I've applied your suggestion in a slightly more extensive revision, using StringUtils.getFilename instead of a temporary File instance now.

@jhoeller jhoeller closed this Apr 6, 2017
@jhordies

jhordies commented Apr 6, 2017

Copy link
Copy Markdown
Author

@jhoeller Thanks for your fast reaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants