ソースを参照

修改文件下载逻辑

tianboguang 2 年 前
コミット
28cbd7fb63

+ 1 - 1
4dkankan-utils-fyun-local/src/main/java/com/fdkankan/fyun/local/LocalFileService.java

@@ -60,7 +60,7 @@ public class LocalFileService extends AbstractFYunFileService {
     @Override
     public void downloadFileByCommand(String bucket, String filePath, String remoteFilePath) {
         try {
-            String optType = new File(filePath).isDirectory() ? "folder" : "file";
+            String optType = remoteFilePath.contains(".") ? "folder" : "file";
             String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, filePath, remoteFilePath, FYunTypeEnum.LOCAL.code(), optType);
             log.info("开始下载文件, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
             callshell(command);

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

@@ -93,7 +93,7 @@ public class OssFileService extends AbstractFYunFileService {
     @Override
     public void downloadFileByCommand(String bucket, String filePath, String remoteFilePath) {
         try {
-            String optType = new File(filePath).isDirectory() ? "folder" : "file";
+            String optType = remoteFilePath.contains(".") ? "folder" : "file";
             String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, remoteFilePath, filePath, FYunTypeEnum.OSS.code(), optType);
             log.info("开始下载文件, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
             callshell(command);

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

@@ -102,7 +102,7 @@ public class S3FileService extends AbstractFYunFileService {
     @Override
     public void downloadFileByCommand(String bucket, String filePath, String remoteFilePath) {
         try {
-            String optType = new File(filePath).isDirectory() ? "folder" : "file";
+            String optType = remoteFilePath.contains(".") ? "folder" : "file";
             String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, remoteFilePath, filePath, FYunTypeEnum.AWS.code(), optType);
             log.info("开始下载文件, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
             callshell(command);