From 138e58a1e12c175002d46db2a76808505761f1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Tue, 11 Apr 2023 01:39:31 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF=20=E4=BF=AE=E6=94=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8F=90=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- .../src/main/java/cn/keking/web/controller/FileController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/src/main/java/cn/keking/web/controller/FileController.java b/server/src/main/java/cn/keking/web/controller/FileController.java index 0dcf2938..6d726fc6 100644 --- a/server/src/main/java/cn/keking/web/controller/FileController.java +++ b/server/src/main/java/cn/keking/web/controller/FileController.java @@ -36,7 +36,6 @@ public class FileController { private final String demoDir = "demo"; private final String demoPath = demoDir + File.separator; public static final String BASE64_DECODE_ERROR_MSG = "Base64解码失败,请检查你的 %s 是否采用 Base64 + urlEncode 双重编码了!"; - private static final String[] not_allowed = { "dll", "exe", "msi" }; // 不允许上传的文件扩展名 @PostMapping("/fileUpload") public ReturnResponse fileUpload(@RequestParam("file") MultipartFile file) { @@ -65,11 +64,11 @@ public class FileController { if (checkResult.isFailure()) { return checkResult; } + fileName = checkResult.getContent().toString(); if(!ConfigConstants.getpassword().equalsIgnoreCase(password)){ logger.error("删除文件【{}】失败,密码错误!",fileName); return ReturnResponse.failure("删除文件失败,密码错误!"); } - fileName = checkResult.getContent().toString(); File file = new File(fileDir + demoPath + fileName); logger.info("删除文件:{}", file.getAbsolutePath()); if (file.exists() && !file.delete()) {