-
Notifications
You must be signed in to change notification settings - Fork 464
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
According to RFC 6570 Section 3.2.1: reserved ("+") and fragment ("#") expansions allow the set of characters in the union of ( unreserved / reserved / pct-encoded ) to be passed through without pct-encoding, whereas all other expression types allow only unreserved characters to be passed through without pct-encoding.
But currently pct-encoded characters are being re-encoded. Meaning that {+var} and {#var} should not re-encode already pct-encoded triplets, but currently the implementation does that:
Code example
@Test
void textUriTemplate_shouldNotEncodeAlreadyPercentEncodedTriplets() {
String template = "{+var}";
Map<String, Object> variables = Map.of("var", "admin%2F");
String result = UriTemplate.expand(template, variables, false);
// Expecting the result to be "admin%2F" without encoding
Assertions.assertEquals("admin%2F", result, "The encoded character should not be changed.");
}Expected : admin%2F
Actual : admin%252FRequested feature:
- Extend the Level 2 templates support to not re-encode already percent-encoded triplets (e.g., %20 should remain %20) when reserved ("+") and fragment ("#") expansions are used.
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.