Commit 480fbe41 by 黎配弘

尝试修复路径遍历的问题

parent e7592b9a
...@@ -185,18 +185,18 @@ public class PackageController extends BaseController { ...@@ -185,18 +185,18 @@ public class PackageController extends BaseController {
@Permission(menuname = "上传背景图", value = "backgroundUpload", method = RequestMethod.POST) @Permission(menuname = "上传背景图", value = "backgroundUpload", method = RequestMethod.POST)
public ResponseData<String> backgroundUpload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "id", required = false) String id) { public ResponseData<String> backgroundUpload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "id", required = false) int id) {
String subfix = ""; String subfix = "";
String backgroundpath = FilePath.BACKGROUNDIMG.getValue() + "/" + DEFAULTPATH + "/"; String backgroundpath = FilePath.BACKGROUNDIMG.getValue() + "/" + DEFAULTPATH + "/";
if (StringUtils.isBlank(id)) { if (id < 1) {
EntityWrapper<Package> packagewrapper = new EntityWrapper<>(); EntityWrapper<Package> packagewrapper = new EntityWrapper<>();
packagewrapper.setSqlSelect("max(id) as id"); packagewrapper.setSqlSelect("max(id) as id");
List<Map<String, Object>> selectMaps = packageMapper.selectMaps(packagewrapper); List<Map<String, Object>> selectMaps = packageMapper.selectMaps(packagewrapper);
id = selectMaps.get(0).get("id").toString(); id = Integer.parseInt(selectMaps.get(0).get("id").toString());
Integer fileid = Integer.valueOf(id) + 1; Integer fileid = id + 1;
subfix = fileid.toString(); subfix = fileid.toString();
} else { } else {
subfix = id; subfix = String.valueOf(id);
} }
backgroundpath = backgroundpath + subfix.replace(".", ""). backgroundpath = backgroundpath + subfix.replace(".", "").
replace("/", "").replace("\\", ""); replace("/", "").replace("\\", "");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment