Gargi-jais11 commented on code in PR #10586:
URL: https://github.com/apache/ozone/pull/10586#discussion_r3510929187


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java:
##########
@@ -157,17 +159,21 @@ Response handleGetRequest(S3RequestContext context, 
String bucketName) throws IO
     if (encodingType != null && !encodingType.equals(ENCODING_TYPE)) {
       throw S3ErrorTable.newError(S3ErrorTable.INVALID_ARGUMENT, encodingType);
     }
-
     // If you specify the encoding-type request parameter,should return
-    // encoded key name values in the following response elements:
-    //   Delimiter, Prefix, Key, and StartAfter.
+    // encoded key name values in the following response elements: Delimiter,
+    // Key, and StartAfter. The echoed Prefix request parameter is returned 
without URL encoding.
     //
     // For detail refer:
     // 
https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#AmazonS3-ListObjectsV2-response-EncodingType
     ListObjectResponse response = new ListObjectResponse();
-    response.setDelimiter(EncodingTypeObject.createNullable(delimiter, 
encodingType));
+    // AWS omits Delimiter from the response when the client passes delimiter= 
or does not specify delimiter at all.
+    if (StringUtils.isNotEmpty(delimiter)) {
+      response.setDelimiter(EncodingTypeObject.createNullable(delimiter, 
encodingType));
+    }
     response.setName(bucketName);
-    response.setPrefix(EncodingTypeObject.createNullable(prefix, 
encodingType));
+    if (prefixSpecified) {
+      response.setPrefix(EncodingTypeObject.createNullable(prefix, null));
+    }

Review Comment:
   @Russole for now I have reverted the fix as this URL-encoded seems to be 
coming from aws s3 itself. Which is verified from the above experiment which I 
did locally. We can come up for this test fix later. Focusing this PR to the 
two fix only.



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