From cd34c87afa730c48e2b2be61d700b1fee409e02c Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 12 七月 2021 11:00:12 +0800 Subject: [PATCH] fix 修复升级合并错误 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 7418a2c..d61f99f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -18,6 +18,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.util.HashMap; import java.util.Map; @@ -51,13 +52,13 @@ } String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); String filePath = RuoYiConfig.getDownloadPath() + fileName; - + File file = new File(filePath); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); FileUtils.setAttachmentResponseHeader(response, realFileName); - FileUtils.writeBytes(filePath, response.getOutputStream()); + FileUtils.writeToStream(file, response.getOutputStream()); if (delete) { - FileUtils.deleteFile(filePath); + FileUtils.del(file); } } catch (Exception e) @@ -110,8 +111,9 @@ // 涓嬭浇鍚嶇О String downloadName = StrUtil.subAfter(downloadPath, "/",true); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + File file = new File(downloadPath); FileUtils.setAttachmentResponseHeader(response, downloadName); - FileUtils.writeBytes(downloadPath, response.getOutputStream()); + FileUtils.writeToStream(file, response.getOutputStream()); } catch (Exception e) { -- Gitblit v1.9.3