elek commented on a change in pull request #1279: HDDS-1942. Support copy 
during S3 multipart upload part creation
URL: https://github.com/apache/hadoop/pull/1279#discussion_r316082174
 
 

 ##########
 File path: 
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java
 ##########
 @@ -736,4 +761,25 @@ private CopyObjectResponse copyObject(String copyHeader,
       }
     }
   }
+
+  /**
+   * Parse the key and bucket name from copy header.
+   */
+  private Pair<String, String> parseSourceHeader(String copyHeader)
+      throws OS3Exception {
+    String header = copyHeader;
+    if (header.startsWith("/")) {
+      header = copyHeader.substring(1);
+    }
+    int pos = header.indexOf("/");
+    if (pos == -1) {
+      OS3Exception ex = S3ErrorTable.newError(S3ErrorTable
+          .INVALID_ARGUMENT, header);
+      ex.setErrorMessage("Copy Source must mention the source bucket and " +
+          "key: sourcebucket/sourcekey");
+      throw ex;
+    }
+
+    return Pair.of(copyHeader.substring(0, pos), copyHeader.substring(pos + 
1));
 
 Review comment:
   Thanks, you are right. I fixed it and created a unit test for this utility 
method.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to