Browse Source

将获取文件的接口做额外的处理7

Yangzw 1 month ago
parent
commit
1d6a496c3b

+ 1 - 0
feifan-framework/feifan-common/src/main/java/cn/newfeifan/mall/framework/common/util/servlet/ServletUtils.java

@@ -160,6 +160,7 @@ public class ServletUtils {
     public static File fileTransition(byte[] content,String path) throws IOException{
         File file = new File(getAbsolutePath(path));
         log.info("======file:{}",file);
+        log.info("===file.length:{}",file.length());
         if(!file.exists()){
             boolean newFile = file.createNewFile();
             log.info("=====创建文件yse or no:{}",newFile);

+ 1 - 1
feifan-module-infra/feifan-module-infra-biz/src/main/java/cn/newfeifan/mall/module/infra/controller/admin/file/FileController.java

@@ -85,7 +85,7 @@ public class FileController {
         if (path.contains("mp4")) {
             String range = request.getHeader("Range");
             log.info("========Range:{}", range);
-            ServletUtils.transfer(content, range, response, "/data/file" + path);
+            ServletUtils.transfer(content, range, response, "/data/file/" + path);
         } else {
             log.info("===============开始获取文件");
             ServletUtils.writeAttachment(response, path, content, request);