Skip to content

SPR-15411: Avoid query parameters in filename #1372

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

Closed
wants to merge 1 commit into from

Conversation

jhordies
Copy link

@jhordies jhordies commented Apr 4, 2017

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

@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

@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
Copy link
Contributor

jhoeller commented Apr 6, 2017

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
Copy link
Author

jhordies commented Apr 6, 2017

@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