Fixed error while moving file to deleted folder
This commit is contained in:
@@ -153,11 +153,17 @@ public class AmazonS3ServiceImpl implements AmazonS3Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String decodeS3Key(String key) {
|
||||||
|
return URLDecoder.decode(key, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath) {
|
public UploadFileOnAmazonS3Response moveFile(String fileName, String oldPath, String newPath) {
|
||||||
try {
|
try {
|
||||||
|
log.info("Original Paths - oldPath: {}, newPath: {}", oldPath, newPath);
|
||||||
|
|
||||||
|
oldPath = decodeS3Key(cleanOldPath(oldPath));
|
||||||
newPath = cleanNewPath(oldPath, newPath);
|
newPath = cleanNewPath(oldPath, newPath);
|
||||||
oldPath = cleanOldPath(oldPath);
|
|
||||||
log.info("Moving file from {} to {} in bucket {}", oldPath, newPath, bucketName);
|
log.info("Moving file from {} to {} in bucket {}", oldPath, newPath, bucketName);
|
||||||
|
|
||||||
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldPath, bucketName, newPath);
|
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, oldPath, bucketName, newPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user