chungen0126 commented on code in PR #10786:
URL: https://github.com/apache/ozone/pull/10786#discussion_r3649813032


##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/EndpointBase.java:
##########
@@ -323,6 +342,10 @@ protected Map<String, String> getCustomMetadataFromHeaders(
       for (String key : customMetadataKeys) {
         String mapKey =
             key.substring(CUSTOM_METADATA_HEADER_PREFIX.length());
+        if (mapKey.regionMatches(true, 0, RESERVED_USER_METADATA_KEY_PREFIX, 0,
+            RESERVED_USER_METADATA_KEY_PREFIX.length())) {
+          throw newError(INVALID_ARGUMENT, key);

Review Comment:
   It would be better to add an error message to the exception so the client 
knows what went wrong.



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/util/S3Utils.java:
##########
@@ -162,7 +179,7 @@ public static void validateMultiChunksUpload(HttpHeaders 
headers, String amzDeco
       // We are only interested on "aws-chunked"
       boolean containsAwsChunked = Arrays.stream(contentEncoding.split(","))
           .map(String::trim)
-          .anyMatch(AWS_CHUNKED::equals);
+          .anyMatch(value -> AWS_CHUNKED.equalsIgnoreCase(value));

Review Comment:
   ```suggestion
             .anyMatch(AWS_CHUNKED::equalsIgnoreCase);
   ```



##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java:
##########
@@ -526,6 +522,46 @@ private void putContentType(Map<String, String> metadata) {
     }
   }
 
+  /**
+   * Store standard S3 object headers from the PUT request in key metadata.
+   */
+  private void putStandardObjectHeaders(Map<String, String> metadata) {
+    for (Map.Entry<String, String> entry : overrideQueryParameter.entrySet()) {
+      String headerName = entry.getKey();
+      String value = getHeaders().getHeaderString(headerName);
+      if (HttpHeaders.CONTENT_ENCODING.equals(headerName)) {
+        value = normalizeContentEncoding(value);
+      }
+      if (value != null) {
+        metadata.put(headerName, value);
+      }
+    }
+  }

Review Comment:
   ```suggestion
     private void putStandardObjectHeaders(Map<String, String> metadata) {
       for (String headerName : overrideQueryParameter.keySet()) {
         String value = getHeaders().getHeaderString(headerName);
         if (HttpHeaders.CONTENT_ENCODING.equals(headerName)) {
           value = normalizeContentEncoding(value);
         }
         if (value != null) {
           metadata.put(headerName, value);
         }
       }
     }
   ```



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