gnodet-bot commented on code in PR #27590:
URL: https://github.com/apache/camel/pull/27590#discussion_r4225463634


##########
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:
   💡 **Coverage gap:** All test values contain exactly one `%26`. Consider 
adding a case with multiple consecutive encoded ampersands to confirm the 
marker approach handles chained occurrences correctly:
   
   ```suggestion
           assertThat(URISupport.normalizeUri(out)).isEqualTo(out);
           // multiple encoded & in the same value
           
assertThat(URISupport.normalizeUri("log:foo?marker=a%26b%26c")).isEqualTo("log://foo?marker=a%26b%26c");
   ```



-- 
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]

Reply via email to