Fixed error while moving file to deleted folder

This commit is contained in:
rajesh
2025-01-20 12:17:35 +05:30
parent 378d91f9e6
commit 664040f2f9

View File

@@ -153,11 +153,17 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
}
}
private String decodeS3Key(String key) {
return URLDecoder.decode(key, StandardCharsets.UTF_8);
}
@Override
public UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath) {
try {
log.info("Original Paths - oldPath: {}, newPath: {}", oldPath, newPath);
oldPath = decodeS3Key(cleanOldPath(oldPath));
newPath = cleanNewPath(oldPath, newPath);
oldPath = cleanOldPath(oldPath);
log.info("Moving file from {} to {} in bucket {}", oldPath, newPath, bucketName);
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldPath, bucketName, newPath);