From 2cf6432f3da0e1debc0b16115116a9e771e7d7af Mon Sep 17 00:00:00 2001
From: zhanglipeng <chinazhanglipeng@qq.com>
Date: Mon, 18 Oct 2021 16:41:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../project/common/CommonController.java      | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java b/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java
index 70c4bd755..df2ea3d52 100644
--- a/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java
+++ b/ruoyi/src/main/java/com/ruoyi/project/common/CommonController.java
@@ -54,16 +54,23 @@ public class CommonController {
      * @param delete   是否删除
      */
     @GetMapping("common/download")
-    public void fileDownload(String fileName,String fileUrlPath ,Boolean delete, HttpServletResponse response, HttpServletRequest request) {
+    public void fileDownload(String fileName, String fileUrlPath, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
         try {
             if (!FileUtils.isValidFilename(fileName)) {
                 throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
             }
             //String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
-            String filePath = RuoYiConfig.getDownuploadPath() + fileUrlPath;
-            filePath=filePath.replace("/profile/","");
+//            String filePath = RuoYiConfig.getDownuploadPath() + fileUrlPath;
+//            filePath=filePath.replace("/profile/","");
 
-            System.out.println("filepath"+filePath);
+            String filePath = "";
+            if (fileUrlPath.equals("undefined")) {
+                filePath = RuoYiConfig.getDownloadPath() + fileName;
+            } else {
+                filePath = RuoYiConfig.getDownuploadPath() + fileUrlPath.replace("/profile/", "");
+            }
+
+            System.out.println("filepath" + filePath);
 
             response.setCharacterEncoding("utf-8");
             response.setContentType("multipart/form-data");
@@ -144,8 +151,9 @@ public class CommonController {
     }
 
     /**
-     *获取七牛资源地址
-     *@param URL 上传的资源名称
+     * 获取七牛资源地址
+     *
+     * @param URL 上传的资源名称
      */
     public String privateDownloadUrl(String URL) {