浏览代码

修改删除文件逻辑

tianboguang 2 年之前
父节点
当前提交
588d6b4d04

+ 4 - 3
4dkankan-utils-fyun-oss/src/main/java/com/fdkankan/fyun/oss/OssFileService.java

@@ -125,10 +125,11 @@ public class OssFileService extends AbstractFYunFileService {
     @Override
     public void deleteFolder(String bucket, String remoteFolderPath) {
         try {
-            if (!remoteFolderPath.endsWith(File.separator)) {
-                remoteFolderPath = remoteFolderPath + File.separator;
-            }
 
+            if (!remoteFolderPath.endsWith("/")) {
+                remoteFolderPath = remoteFolderPath + "/";
+            }
+            log.info("开始删除文件夹:{}", remoteFolderPath);
             boolean flag = true;
             String nextMaker = null;
             ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucket).withPrefix(remoteFolderPath).withMaxKeys(1000);

+ 1 - 2
4dkankan-utils-fyun-s3/src/main/java/com/fdkankan/fyun/s3/S3FileService.java

@@ -139,11 +139,10 @@ public class S3FileService extends AbstractFYunFileService {
     @Override
     public void deleteFolder(String bucket, String remoteFolderPath){
         try {
-
             if (!remoteFolderPath.endsWith(File.separator)) {
                 remoteFolderPath = remoteFolderPath + File.separator;
             }
-
+            log.info("开始删除文件夹:{}", remoteFolderPath);
             int maxKeys = 1000;
             String nextMaker = null;