tomtongue commented on code in PR #16859:
URL: https://github.com/apache/iceberg/pull/16859#discussion_r4740026940


##########
aliyun/src/test/java/org/apache/iceberg/aliyun/oss/mock/AliyunOSSMock.java:
##########
@@ -81,9 +81,9 @@ private class AliyunHttpHandler implements HttpHandler {
     @Override
     public void handle(HttpExchange httpExchange) throws IOException {
       String request = httpExchange.getRequestURI().getPath().substring(1);
-      String[] requests = request.split("/");
+      String[] requests = request.split("/", 2);
       String bucketName = requests[0];
-      if (requests.length == 1) {
+      if (requests.length == 1 || requests[1].isEmpty()) {

Review Comment:
   Note on the `AliyunOSSMock` change: `AliyunOSSMock` previously used 
`request.split("/")` and took only `requests[1]` as the object key, which 
truncated nested paths. Because `AliyunOSSMockExtension.keyPrefix()` is 
`mock-objects/`, multiple objects created via `location(...)` in the same test 
(such as `v1.metadata.json` and `v2.metadata.json` in `TestOSSFileIO`) all 
collided on `"mock-objects"`. Using `request.split("/", 2)` preserves the full 
object key while keeping bucket-level requests (`requests.length == 1 || 
requests[1].isEmpty()`) unchanged.
   



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