-
Notifications
You must be signed in to change notification settings - Fork 471
UriTemplate redundantly percent encodes literal part #1127
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
Comments
odrotbohm
added a commit
that referenced
this issue
Nov 28, 2019
We now directly use UriComponentsBuilder in UriTemplate.expand(…) to avoid potential double encoding in the base URI.
odrotbohm
added a commit
that referenced
this issue
Nov 28, 2019
We now directly use UriComponentsBuilder in UriTemplate.expand(…) to avoid potential double encoding in the base URI.
I followed @rstoyanchev's advice from spring-projects/spring-framework#24094 and avoid Spring's |
Possibly related to #593. If so, and if resolved, there’s a great test case we’ll be a me to add there to avoid regressions. |
I revisited encoding related tickets and am just polishing up a fix for #593. |
Great, many thanks @odrotbohm ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using
UriTemplate
with a literal part using reserved characters the part is percent encoded twice. For exampleyields
https://example.org/foo%2520and%2520bar/xyzzy
rather than the expectedhttps://example.org/foo%20and%20bar/xyzzy
. I think this happens becauseUriTemplate.expand
first constructs and expands a Spring FrameworkUriTemplate
from the literal part (which adds percent encoding), builds aUriComponentsBuilder
from the result and later callsbuild
with no arguments on thisUriComponentsBuilder
which adds another layer of percent encoding. I think it would be possible to percent encode all variable values beforehand and then invokebuild(false)
instead, but I haven't checked all code paths.Note that when using UriTemplate with a properly percent-encoded literal part to begin with, things become even worse because of spring-projects/spring-framework#24094.
yields
https://example.org/foo%252520and%252520bar/xyzzy
.The text was updated successfully, but these errors were encountered: