allthingssecurity commented on code in PR #27590:
URL: https://github.com/apache/camel/pull/27590#discussion_r4225581502
##########
core/camel-util/src/test/java/org/apache/camel/util/URISupportTest.java:
##########
@@ -148,6 +148,39 @@ public void testNormalizeHttpEndpointURLEncodedParameter()
throws Exception {
assertEquals("http://www.google.com?q=S%C3%B8ren+Hansen", out);
}
+ @Test
+ public void testNormalizeEncodedAmpersand() throws Exception {
+ // an encoded & (%26) is part of a key or value, not a separator
between parameters
+
assertThat(URISupport.normalizeUri("log:foo?marker=a%26b")).isEqualTo("log://foo?marker=a%26b");
+
assertThat(URISupport.normalizeUri("log:foo?showAll=true&marker=a%26b"))
+ .isEqualTo("log://foo?marker=a%26b&showAll=true");
+
assertThat(URISupport.normalizeUri("log:foo?a%26b=1")).isEqualTo("log://foo?a%26b=1");
+
assertThat(URISupport.normalizeUri("http://www.google.com?q=Tom%26Jerry"))
+ .isEqualTo("http://www.google.com?q=Tom%26Jerry");
+ // an encoded & at the end of a value is not a trailing & marker
+
assertThat(URISupport.normalizeUri("log:foo?marker=%E2%82%AC%26")).isEqualTo("log://foo?marker=%E2%82%AC%26");
+ String out =
URISupport.normalizeUri("log:foo?showAll=true&marker=a%26b");
+ assertThat(URISupport.normalizeUri(out)).isEqualTo(out);
Review Comment:
Added in 4b3fcf377d17: `a%26b%26c`, `a%26%26b` with another option, and
`%26%26` alone each normalize to themselves (ran them, e.g.
`log://foo?marker=a%26b%26c`), and `parseParameters` gives `a&b&c` and `&&`.
_Claude Code on behalf of allthingssecurity_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]