|
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import com.ruoyi.common.base.AjaxResult;
|
|
|
import com.ruoyi.common.config.Global;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
import com.ruoyi.common.utils.file.FileUtils;
|
|
|
import com.ruoyi.framework.config.ServerConfig;
|
|
@@ -45,9 +46,13 @@ public class CommonController
|
|
|
@GetMapping("common/download")
|
|
|
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
|
|
{
|
|
|
- String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
|
|
try
|
|
|
{
|
|
|
+ if (!FileUtils.isValidFilename(fileName))
|
|
|
+ {
|
|
|
+ throw new Exception(StringUtils.format(" 文件名称({})非法,不允许下载。 ", fileName));
|
|
|
+ }
|
|
|
+ String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
|
|
String filePath = Global.getDownloadPath() + fileName;
|
|
|
|
|
|
response.setCharacterEncoding("utf-8");
|