From f21bc85d1e2b15534b3c5ced8b0c6ca0e03b165e Mon Sep 17 00:00:00 2001 From: Shiv Prakash Date: Mon, 13 Feb 2023 13:14:42 +0530 Subject: [PATCH] Update COSAPIClient.java cos rename method updated to handle eventLog and regular scenarios. --- .../java/com/ibm/stocator/fs/cos/COSAPIClient.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java b/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java index 16880aa8..f0f7d198 100644 --- a/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java +++ b/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java @@ -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 =