You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/08/13 12:40:05 UTC

[GitHub] [hadoop] lokeshj1703 commented on a change in pull request #1279: HDDS-1942. Support copy during S3 multipart upload part creation

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

 ##########
 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:
   I think this should use header instead of copyHeader `Pair.of(header.substring(0, pos), header.substring(pos + 1))`? I think we can just use a single variable here for clarity?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org