Skip to content

Commit

Permalink
Update COSAPIClient.java (#326)
Browse files Browse the repository at this point in the history
cos rename method updated to handle eventLog and regular scenarios.
  • Loading branch information
shivprakashy authored Feb 13, 2023
1 parent 6507e69 commit b218757
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1408,12 +1408,14 @@ public boolean rename(String hostName, String srcPath, String dstPath) throws IO
if (!newDstKey.endsWith("/")) {
newDstKey = newDstKey + "/";
}
// fix start: https://github.com/CODAIT/stocator/issues/318
String filename = newSrcKey.substring(pathToKey(src).length());
newDstKey = newDstKey + filename;

// fix start: https://github.com/CODAIT/stocator/issues/318 & https://github.com/CODAIT/stocator/issues/322
if (pathToKey(src).endsWith(".inprogress")) {
String filename = newSrcKey.substring(pathToKey(src).length());
newDstKey = newDstKey + filename;
newDstKey = newDstKey.substring(0, newDstKey.lastIndexOf("/"));
} else {
String filename = newSrcKey.substring(pathToKey(src).length() + 1);
newDstKey = newDstKey + filename;
}
// fix end
CopyObjectRequest copyObjectRequest =
Expand Down

0 comments on commit b218757

Please sign in to comment.