From e855c9c7ed6fb77971351b310adfa1117575ff40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:30:07 +0000 Subject: [PATCH 01/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- server/src/main/config/application.properties | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/main/config/application.properties b/server/src/main/config/application.properties index 74156404..c820771e 100644 --- a/server/src/main/config/application.properties +++ b/server/src/main/config/application.properties @@ -2,8 +2,9 @@ server.port = ${KK_SERVER_PORT:8012} server.servlet.context-path= ${KK_CONTEXT_PATH:/} server.servlet.encoding.charset = utf-8 -#文件上传限制 +#文件上传限制前端 spring.servlet.multipart.max-file-size=500MB +#文件上传限制 spring.servlet.multipart.max-request-size=500MB ## Freemarker 配置 spring.freemarker.template-loader-path = classpath:/web/ @@ -117,3 +118,9 @@ watermark.angle = ${WATERMARK_ANGLE:10} #Tif类型图片浏览模式:tif(利用前端js插件浏览);jpg(转换为jpg后前端显示);pdf(转换为pdf后显示,便于打印) tif.preview.type = ${KK_TIF_PREVIEW_TYPE:tif} +# 备案信息 +BeiAn = +#禁止上传类型 +prohibit =exe,dll,dat +#删除密码 +sc.password =123456 From 78d517a16e383198f0e50c7ed07fab1bf613a980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:31:58 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- server/src/main/resources/web/main/index.ftl | 125 ++++++++++--------- 1 file changed, 69 insertions(+), 56 deletions(-) diff --git a/server/src/main/resources/web/main/index.ftl b/server/src/main/resources/web/main/index.ftl index 2980ac3f..87b06ee8 100644 --- a/server/src/main/resources/web/main/index.ftl +++ b/server/src/main/resources/web/main/index.ftl @@ -116,33 +116,10 @@
<#if fileUploadDisable == false> -
+
-
-

-
-
- -
-
- -
-
-
-
- - - -
- + +
@@ -175,22 +152,35 @@
+
+
+ ${BeiAn} +
+
From e5e96116469dfa164d5ec189c0373037621dabe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:32:26 +0000 Subject: [PATCH 03/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- .../cn/keking/config/ConfigConstants.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/server/src/main/java/cn/keking/config/ConfigConstants.java b/server/src/main/java/cn/keking/config/ConfigConstants.java index 4ad5a797..6d40765d 100644 --- a/server/src/main/java/cn/keking/config/ConfigConstants.java +++ b/server/src/main/java/cn/keking/config/ConfigConstants.java @@ -42,6 +42,10 @@ public class ConfigConstants { private static String pdfBookmarkDisable; private static Boolean fileUploadDisable; private static String tifPreviewType; + private static String BeiAn; + private static String[] prohibit= {}; + private static String size; + private static String password; public static final String DEFAULT_CACHE_ENABLED = "true"; public static final String DEFAULT_TXT_TYPE = "txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd"; @@ -62,6 +66,10 @@ public class ConfigConstants { public static final String DEFAULT_PDF_BOOKMARK_DISABLE = "true"; public static final String DEFAULT_FILE_UPLOAD_DISABLE = "false"; public static final String DEFAULT_TIF_PREVIEW_TYPE = "tif"; + public static final String DEFAULT_BeiAn_DISABLE = "无"; + public static final String DEFAULT_size_DISABLE = "500MB"; + public static final String DEFAULT_prohibit_DISABLE = "exe,dll"; + public static final String DEFAULT_password_DISABLE = "123456"; public static Boolean isCacheEnabled() { return cacheEnabled; @@ -353,4 +361,49 @@ public class ConfigConstants { public static void setTifPreviewTypeValue(String tifPreviewType) { ConfigConstants.tifPreviewType = tifPreviewType; } + + public static String getBeiAn() { + return BeiAn; + } + @Value("${BeiAn:无}") + public void setBeiAn(String BeiAn) { + setBeiAnValue(BeiAn); + } + public static void setBeiAnValue(String BeiAn) { + ConfigConstants.BeiAn = BeiAn; + } + public static String[] getprohibit() { + return prohibit; + } + @Value("${prohibit:exe,dll}") + public void setprohibit(String prohibit) { + String[] prohibittArr = prohibit.split(","); + setprohibitValue(prohibittArr); + } + + public static void setprohibitValue(String[] prohibit) { + ConfigConstants.prohibit = prohibit; + } + public static String maxsize() { + return size; + } + @Value("${spring.servlet.multipart.max-file-size:500MB}") + public void setsize(String size) { + setsizeValue(size); + } + public static void setsizeValue(String size) { + ConfigConstants.size = size; + } + + public static String getpassword() { + return password; + } + @Value("${sc.password:123456}") + public void setpassword(String password) { + setpasswordValue(password); + } + public static void setpasswordValue(String password) { + ConfigConstants.password = password; + } + } From 181897ec5a0c5a1943e4f0c71c84e2d16c67f2b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:32:51 +0000 Subject: [PATCH 04/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- .../cn/keking/config/ConfigRefreshComponent.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java index 84154617..d3cfcb83 100644 --- a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java +++ b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java @@ -53,7 +53,11 @@ public class ConfigRefreshComponent { String pdfBookmarkDisable; boolean fileUploadDisable; String tifPreviewType; - + String prohibit; + String[] prohibitArray; + String BeiAn; + String size; + String password; while (true) { FileReader fileReader = new FileReader(configFilePath); BufferedReader bufferedReader = new BufferedReader(fileReader); @@ -78,6 +82,11 @@ public class ConfigRefreshComponent { pdfBookmarkDisable = properties.getProperty("pdf.bookmark.disable", ConfigConstants.DEFAULT_PDF_BOOKMARK_DISABLE); fileUploadDisable = Boolean.parseBoolean(properties.getProperty("file.upload.disable", ConfigConstants.DEFAULT_FILE_UPLOAD_DISABLE)); tifPreviewType = properties.getProperty("tif.preview.type", ConfigConstants.DEFAULT_TIF_PREVIEW_TYPE); + size = properties.getProperty("spring.servlet.multipart.max-file-size", ConfigConstants.DEFAULT_size_DISABLE); + BeiAn = properties.getProperty("BeiAn", ConfigConstants.DEFAULT_BeiAn_DISABLE); + prohibit = properties.getProperty("prohibit", ConfigConstants.DEFAULT_prohibit_DISABLE); + password = properties.getProperty("sc.password", ConfigConstants.DEFAULT_password_DISABLE); + prohibitArray = prohibit.split(","); ConfigConstants.setCacheEnabledValueValue(cacheEnabled); ConfigConstants.setSimTextValue(textArray); @@ -96,6 +105,10 @@ public class ConfigRefreshComponent { ConfigConstants.setPdfBookmarkDisableValue(pdfBookmarkDisable); ConfigConstants.setFileUploadDisableValue(fileUploadDisable); ConfigConstants.setTifPreviewTypeValue(tifPreviewType); + ConfigConstants.setBeiAnValue(BeiAn); + ConfigConstants.setsizeValue(size); + ConfigConstants.setprohibitValue(prohibitArray); + ConfigConstants.setpasswordValue(password); setWatermarkConfig(properties); bufferedReader.close(); fileReader.close(); From 75a46a14a8568f337e56c66f4f8110dffca3dde6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:33:22 +0000 Subject: [PATCH 05/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- .../keking/web/controller/FileController.java | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 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 b9bb5f47..0dcf2938 100644 --- a/server/src/main/java/cn/keking/web/controller/FileController.java +++ b/server/src/main/java/cn/keking/web/controller/FileController.java @@ -60,11 +60,15 @@ public class FileController { } @GetMapping("/deleteFile") - public ReturnResponse deleteFile(String fileName) { + public ReturnResponse deleteFile(String fileName,String password) { ReturnResponse checkResult = this.deleteFileCheck(fileName); if (checkResult.isFailure()) { return checkResult; } + 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()); @@ -103,8 +107,10 @@ public class FileController { return ReturnResponse.failure("文件传接口已禁用"); } String fileName = WebUtils.getFileNameFromMultipartFile(file); - - if (!isAllowedUpload(fileName)) { + if(fileName.lastIndexOf(".")==-1){ + return ReturnResponse.failure("不允许上传的类型"); + } + if (!KkFileUtils.isAllowedUpload(fileName)) { return ReturnResponse.failure("不允许上传的文件类型: " + fileName); } if (KkFileUtils.isIllegalFileName(fileName)) { @@ -117,20 +123,6 @@ public class FileController { return ReturnResponse.success(fileName); } - /** - * 判断文件是否允许上传 - * - * @param file 文件扩展名 - * @return 是否允许上传 - */ - private boolean isAllowedUpload(String file) { - String fileType = KkFileUtils.suffixFromFileName(file); - for (String type : not_allowed) { - if (type.equals(fileType)) - return false; - } - return !ObjectUtils.isEmpty(fileType); - } /** * 删除文件前校验 From c7367dfcec426384f5860261e2a790a55ba01d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:34:37 +0000 Subject: [PATCH 06/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- .../main/java/cn/keking/utils/KkFileUtils.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/src/main/java/cn/keking/utils/KkFileUtils.java b/server/src/main/java/cn/keking/utils/KkFileUtils.java index aa7a8bfe..b4785565 100644 --- a/server/src/main/java/cn/keking/utils/KkFileUtils.java +++ b/server/src/main/java/cn/keking/utils/KkFileUtils.java @@ -1,7 +1,9 @@ package cn.keking.utils; +import cn.keking.config.ConfigConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.web.util.HtmlUtils; @@ -174,4 +176,19 @@ public class KkFileUtils { return true; } + /** + * 判断文件是否允许上传 + * + * @param file 文件扩展名 + * @return 是否允许上传 + */ + public static boolean isAllowedUpload(String file) { + String fileType = suffixFromFileName(file); + for (String type : ConfigConstants.getprohibit()) { + if (type.equals(fileType)) + return false; + } + return !ObjectUtils.isEmpty(fileType); + } + } From 7b699e08fc891bdac574173bdc38a4d55aa3d59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:35:15 +0000 Subject: [PATCH 07/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- server/src/main/java/cn/keking/utils/DownloadUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/main/java/cn/keking/utils/DownloadUtils.java b/server/src/main/java/cn/keking/utils/DownloadUtils.java index c4a17383..69c08b17 100644 --- a/server/src/main/java/cn/keking/utils/DownloadUtils.java +++ b/server/src/main/java/cn/keking/utils/DownloadUtils.java @@ -49,6 +49,12 @@ public class DownloadUtils { logger.error("忽略SSL证书异常:", e); } ReturnResponse response = new ReturnResponse<>(0, "下载成功!!!", ""); + if (!KkFileUtils.isAllowedUpload(fileName)) { + response.setCode(1); + response.setContent(null); + response.setMsg("下载失败:不支持的类型!" + urlStr); + return response; + } assert urlStr != null; if (urlStr.contains("?fileKey=")) { response.setContent(fileDir + urlStrr); From c055d3d99256b3be209472db802e73e717c759ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Mon, 10 Apr 2023 09:36:09 +0000 Subject: [PATCH 08/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E4=BF=A1=E6=81=AF,=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B1=BB=E5=9E=8B,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- .../src/main/java/cn/keking/web/filter/AttributeSetFilter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java b/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java index bce3c936..befcdea7 100644 --- a/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java +++ b/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java @@ -40,6 +40,8 @@ public class AttributeSetFilter implements Filter { request.setAttribute("fileKey", httpRequest.getParameter("fileKey")); request.setAttribute("switchDisabled", ConfigConstants.getOfficePreviewSwitchDisabled()); request.setAttribute("fileUploadDisable", ConfigConstants.getFileUploadDisable()); + request.setAttribute("BeiAn", ConfigConstants.getBeiAn()); + request.setAttribute("size", ConfigConstants.maxsize()); } /** From 8916bee7867030588f3bc39c56ed85e482bdb692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Tue, 11 Apr 2023 01:19:17 +0000 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- server/src/main/resources/web/main/index.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/resources/web/main/index.ftl b/server/src/main/resources/web/main/index.ftl index 87b06ee8..21231c3c 100644 --- a/server/src/main/resources/web/main/index.ftl +++ b/server/src/main/resources/web/main/index.ftl @@ -291,7 +291,7 @@ // console.log(daxiao) var maxsize = daxiao * 1024 * 1024; var errMsg = "上传的文件不能超过${size}喔!!!"; - var tipMsg = "您的浏览器暂不支持上传,确保上传文件不要超过2M,建议使用IE、FireFox、Chrome浏览器"; + var tipMsg = "您的浏览器暂不支持上传,确保上传文件不要超过${size},建议使用IE、FireFox、Chrome浏览器"; try { var filesize = 0; var ua = window.navigator.userAgent; From 55ca17203fe4ded53cd999ef179b609565530b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Tue, 11 Apr 2023 01:38:08 +0000 Subject: [PATCH 10/11] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=AF=86=E7=A0=81,=E5=89=8D=E7=AB=AF=E9=99=90=E5=88=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=A7=E5=B0=8F=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AF=86=E7=A0=81,=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=99=90=E5=88=B6=E4=B8=8A=E4=BC=A0=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- server/src/main/resources/web/main/index.ftl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/src/main/resources/web/main/index.ftl b/server/src/main/resources/web/main/index.ftl index 21231c3c..fb977325 100644 --- a/server/src/main/resources/web/main/index.ftl +++ b/server/src/main/resources/web/main/index.ftl @@ -164,20 +164,19 @@ $.ajax({ url: '${baseUrl}deleteFile?fileName=' + fileName +'&password='+password, success: function (data) { + // console.log(data); // 删除完成,刷新table - if ("删除文件失败,密码错误!" === data) { - alert(data); + if ("删除文件失败,密码错误!" === data.msg) { + alert(data.msg); } else { $('#table').bootstrapTable('refresh', {}); } }, error: function (data) { - console.log(data); return false; } }) }else{ - //alert("取消"); return false; } @@ -257,9 +256,6 @@ $("#btnSubmit").click(function () { var filepath = $("#size").val(); - var arr = filepath.split('\\'); //通过\分隔字符串,成字符串数组 - var fileName = arr[arr.length-1]; //取最后一个,就是文件全名,含后缀 - if(!checkFileSize(filepath)){ return false; } 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 11/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=94=99=E8=AF=AF=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=A0=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()) {