Commit 9b487815 by 黎配弘

尝试处理路径遍历的问题

parent de9a6c17
......@@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
* @Author: chancy
......@@ -51,6 +52,8 @@ public class PackageController extends BaseController {
private static final String XIAOTUFILENAME = "logo.png";
private static final Pattern FilePattern = Pattern.compile("[\\\\/:*?\"<>|]");
@Autowired
public PackageController(PackageMapper packageMapper, SchoolPackageMapper schoolPackageMapper) {
......@@ -200,7 +203,7 @@ public class PackageController extends BaseController {
} else {
basePath.append(id);
}
File dir = new File(basePath.toString());
File dir = new File(FilePattern.matcher(basePath.toString()).replaceAll(""));
if (!dir.exists()) {
dir.mkdirs();
}
......
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