-
Notifications
You must be signed in to change notification settings - Fork 41.5k
JSON keys containing a dot from CF environment are not handled as a single path segment #18915
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
Conversation
@schulzh Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@schulzh Thank you for signing the Contributor License Agreement! |
I have a
This is meant to supply Authentication information for arbitrary hosts, which will be the keys of the map, therefore the dots in the keys. I just tested a |
if (key.startsWith("[")) { | ||
return path + key; | ||
} | ||
if (key.contains(".")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd have to do this for any characters that are not alpha-numeric or -
.
@schulzh would you have time to revisit the PR based on Madura's feedback? |
Along with surrounding map keys with dot from VCAP_SERVICES with `[ ]`, this commit also does that for non-alphanumeric and `-` characters so that they are not stripped off later. See gh-18915
@schulzh Thank you for making your first contribution to Spring Boot. This has now been merged along with this addition. |
This PR changes the handling of JSON keys in the CloudFoundry VCAP_SERVICES environment variable so that they represent only a single path segment at a time.
Before this change, if the JSON contained an object key with dots, the key would be treated as individual path segments, instead of a single one.
E.g. the VCAP_SERVICES variable
Would lead to the spring property:
vcap.services.test.credentials.key.with.dots.username=foo
Instead of the escaped version:
vcap.services.test.credentials[key.with.dots].username=foo
This causes problems e.g. when trying to bind these properties to a map, as it would not be filled with any values: