修复界面存在的一些安全问题

This commit is contained in:
RuoYi
2019-02-27 12:29:03 +08:00
parent d399160a0b
commit 807b723116
6 changed files with 47 additions and 5 deletions

View File

@ -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");

View File

@ -282,7 +282,6 @@
url: options.url, // 请求后台的URL*
ajaxParams: options.ajaxParams, // 请求数据的ajax的data属性
height: options.height, // 表格树的高度
ajaxParams: {}, // 请求数据的ajax的data属性
expandColumn: options.expandColumn, // 在哪一列上面显示展开按钮
striped: options.striped, // 是否显示行间隔色
bordered: true, // 是否显示边框