huaxingao commented on code in PR #18015:
URL: https://github.com/apache/iceberg/pull/18015#discussion_r4021013250


##########
core/src/test/java/org/apache/iceberg/rest/TestRESTUtil.java:
##########
@@ -200,6 +205,93 @@ public void encodePathAsOldAndNewClientDecodeAsNewServer() 
{
     assertThat(RESTUtil.decodePathSegment(encodedOther)).isEqualTo(input);
   }
 
+  @ParameterizedTest
+  @ValueSource(strings = {"%1F", "%2D", "%2E", "#", "_"})
+  public void encodeReferencedBy(String namespaceSeparator) {
+    // the separator is used as configured, joining the namespace levels and 
the view name
+    assertThat(
+            RESTUtil.encodeReferencedBy(
+                ImmutableList.of(TableIdentifier.of(Namespace.of("ns"), 
"viewName")),
+                namespaceSeparator))
+        .isEqualTo(String.format("ns%sviewName", namespaceSeparator));

Review Comment:
   I think this test passes no matter what the separator is, because it builds 
the expected value from the same separator it just passed in. So it checks that 
the function used the separator, but not that the result is safe to put in a 
URL.
   
   Could we build the real URL with `HTTPRequest.requestUri()` and check the 
query string? That would catch a separator that isn't URL-safe.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to