-
Notifications
You must be signed in to change notification settings - Fork 452
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
UriTemplate reserved expansion should not escape reserved characters #1838
Comments
@cHengstler Do you observe problems when you use Google services due to this bug? If so, would you write some code that we can reproduce the problem? |
@suztomo, Thanks for your reply. To reproducte the bug, I've already provided a test case in the description of this issue. Lets say I define a url template The expectation would be that the Unfortunately the result is: public String expandTemplate() {
String template = "https://www.example.com/{+resourceWithFragment}";
Map requestMap = Map.of("resourceWithFragment", "page.html#section1");
return UriTemplate.expand(template, requestMap, false);
} |
The priority of the bug depends on how much suffer from it when using a real Google service rather than test cases. Which Google service do you have problem with? |
We are using this component directly within our project as a maven dependency. |
It's good that you're not suffering from problem with Google service. We may revisit this issue in future. |
Hi @suztomo Thanks |
Yes, that's helpful. That would clarify the change you have mind. https://github.com/googleapis/google-http-java-client/blob/main/CONTRIBUTING.md |
I havent’t checked that pull request yet. Thank you for heads up. |
…1844) When using UriTemplate.expand with a reserved expansion "{+var}", a set of allowed characters must not be encoded. According to section of [3.2.3 Reserved Expansion: {+var}](https://www.rfc-editor.org/rfc/rfc6570#section-3.2.3), unreserved and reserved character should not be escaped. This fix adds the missing characters `#[]` that must not be percent encoded when using reserved expansion. - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) Fixes #1838
I merged #1844. We may have other tasks to include next release. Give me 1 week. |
@cHengstler Your change was released as 1.43.2 https://central.sonatype.com/artifact/com.google.http-client/google-http-client/1.43.2 Thank you for contribution. |
UriTemplate.expand should not escape reserved characters in values for reserved expansion (e.g., templates of the form "{+var}").
According to section of 3.2.3 Reserved Expansion: {+var}, reserved character should not be escaped.
Level 2 templates add the plus ("+") operator, for expansion of values that are allowed to include reserved URI characters (Section 1.5).
Example code:
The text was updated successfully, but these errors were encountered: