diff --git a/README.md b/README.md
index 7462baca..62eb60cd 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
[](https://github.com/elunez/eladmin/blob/master/LICENSE)
@@ -11,9 +11,9 @@
#### 项目简介
一个基于 Spring Boot 2.1.0 、 Spring Boot Jpa、 JWT、Spring Security、Redis、Vue的前后端分离的后台管理系统
-**开发文档:** [https://el-admin.vip](https://el-admin.vip)
+**开发文档:** [https://eladmin.vip](https://eladmin.vip)
-**体验地址:** [https://el-admin.vip/demo](https://el-admin.vip/demo)
+**体验地址:** [https://eladmin.vip/demo](https://eladmin.vip/demo)
**账号密码:** `admin / 123456`
@@ -87,9 +87,9 @@
#### 特别鸣谢
-- 感谢 [JetBrains](https://www.jetbrains.com/) 提供的非商业开源软件开发授权
+- 感谢 [七牛云](https://portal.qiniu.com/signup?utm_source=kaiyuan&utm_media=ELADMIN) 提供的免费云存储与CDN加速支持
-- 感谢 [七牛云](https://www.qiniu.com/) 提供的免费云存储与CDN加速支持
+- 感谢 [JetBrains](https://www.jetbrains.com/) 提供的非商业开源软件开发授权
- 感谢 [PanJiaChen](https://github.com/PanJiaChen/vue-element-admin) 大佬提供的前端模板
@@ -102,7 +102,7 @@
- 感谢 [d15801543974](https://github.com/d15801543974) 大佬提供的基于注解的通用查询方式
#### 项目捐赠
-项目的发展离不开你的支持,请作者喝杯咖啡吧☕ [Donate](https://el-admin.vip/donation/)
+项目的发展离不开你的支持,请作者喝杯咖啡吧☕ [Donate](https://eladmin.vip/donation/)
#### 反馈交流
- QQ交流群:一群:
891137268 、二群:
947578238、三群:659622532
\ No newline at end of file
diff --git a/eladmin-common/src/main/java/me/zhengjie/annotation/DataPermission.java b/eladmin-common/src/main/java/me/zhengjie/annotation/DataPermission.java
index b73c1a24..044d551e 100644
--- a/eladmin-common/src/main/java/me/zhengjie/annotation/DataPermission.java
+++ b/eladmin-common/src/main/java/me/zhengjie/annotation/DataPermission.java
@@ -28,7 +28,7 @@ import java.lang.annotation.Target;
* 应该是 @DataPermission(joinName = "dept", fieldName = "id")
*
* @author Zheng Jie
- * @website https://el-admin.vip
+ * @website https://eladmin.vip
* @date 2020-05-07
**/
@Target(ElementType.TYPE)
diff --git a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java
index bad7f79f..95217a26 100644
--- a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java
+++ b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java
@@ -106,7 +106,7 @@ public class RedisConfig extends CachingConfigurerSupport {
@Override
public KeyGenerator keyGenerator() {
return (target, method, params) -> {
- Map
container = new HashMap<>(4);
+ Map container = new HashMap<>(8);
Class> targetClassClass = target.getClass();
// 类地址
container.put("class",targetClassClass.toGenericString());
diff --git a/eladmin-common/src/main/java/me/zhengjie/config/RsaProperties.java b/eladmin-common/src/main/java/me/zhengjie/config/RsaProperties.java
index a3594cdb..0a4a5375 100644
--- a/eladmin-common/src/main/java/me/zhengjie/config/RsaProperties.java
+++ b/eladmin-common/src/main/java/me/zhengjie/config/RsaProperties.java
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
/**
* @author Zheng Jie
- * @website https://el-admin.vip
+ * @website https://eladmin.vip
* @description
* @date 2020-05-18
**/
diff --git a/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java b/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java
index 6d267746..989be98d 100644
--- a/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java
+++ b/eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java
@@ -77,7 +77,7 @@ public class SwaggerConfig {
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.description("一个简单且易上手的 Spring boot 后台管理框架")
- .title("EL-ADMIN 接口文档")
+ .title("ELADMIN 接口文档")
.version("2.6")
.build();
}
diff --git a/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java b/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java
index 56d73f7d..23cbb383 100644
--- a/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java
+++ b/eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java
@@ -23,10 +23,11 @@ import me.zhengjie.utils.ThrowableUtil;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.validation.FieldError;
+import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
-import java.util.Objects;
import static org.springframework.http.HttpStatus.*;
/**
@@ -95,11 +96,10 @@ public class GlobalExceptionHandler {
public ResponseEntity handleMethodArgumentNotValidException(MethodArgumentNotValidException e){
// 打印堆栈信息
log.error(ThrowableUtil.getStackTrace(e));
- String[] str = Objects.requireNonNull(e.getBindingResult().getAllErrors().get(0).getCodes())[1].split("\\.");
- String message = e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
- String msg = "不能为空";
- if(msg.equals(message)){
- message = str[1] + ":" + message;
+ ObjectError objectError = e.getBindingResult().getAllErrors().get(0);
+ String message = objectError.getDefaultMessage();
+ if (objectError instanceof FieldError) {
+ message = ((FieldError) objectError).getField() + ": " + message;
}
return buildResponseEntity(ApiError.error(message));
}
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/CloseUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/CloseUtil.java
index 98d375be..f39919f2 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/CloseUtil.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/CloseUtil.java
@@ -19,7 +19,7 @@ import java.io.Closeable;
/**
* @author Zheng Jie
- * @website https://el-admin.vip
+ * @website https://eladmin.vip
* @description 用于关闭各种连接,缺啥补啥
* @date 2021-03-05
**/
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
index 01a3f037..5dea6506 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/FileUtil.java
@@ -182,7 +182,8 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
public static File upload(MultipartFile file, String filePath) {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
- String name = getFileNameNoEx(file.getOriginalFilename());
+ // 过滤非法文件名
+ String name = getFileNameNoEx(verifyFilename(file.getOriginalFilename()));
String suffix = getExtensionName(file.getOriginalFilename());
String nowStr = "-" + format.format(date);
try {
@@ -350,6 +351,44 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
}
}
+ /**
+ * 验证并过滤非法的文件名
+ * @param fileName 文件名
+ * @return 文件名
+ */
+ public static String verifyFilename(String fileName) {
+ // 过滤掉特殊字符
+ fileName = fileName.replaceAll("[\\\\/:*?\"<>|~\\s]", "");
+
+ // 去掉文件名开头和结尾的空格和点
+ fileName = fileName.trim().replaceAll("^[. ]+|[. ]+$", "");
+
+ // 不允许文件名超过255(在Mac和Linux中)或260(在Windows中)个字符
+ int maxFileNameLength = 255;
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ maxFileNameLength = 260;
+ }
+ if (fileName.length() > maxFileNameLength) {
+ fileName = fileName.substring(0, maxFileNameLength);
+ }
+
+ // 过滤掉控制字符
+ fileName = fileName.replaceAll("[\\p{Cntrl}]", "");
+
+ // 过滤掉 ".." 路径
+ fileName = fileName.replaceAll("\\.{2,}", "");
+
+ // 去掉文件名开头的 ".."
+ fileName = fileName.replaceAll("^\\.+/", "");
+
+ // 保留文件名中最后一个 "." 字符,过滤掉其他 "."
+ fileName = fileName.replaceAll("^(.*)(\\.[^.]*)$", "$1").replaceAll("\\.", "") +
+ fileName.replaceAll("^(.*)(\\.[^.]*)$", "$2");
+
+ return fileName;
+ }
+
+
public static String getMd5(File file) {
return getMd5(getByte(file));
}
diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java b/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
index 69cb5e24..671fff71 100644
--- a/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
+++ b/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
@@ -161,8 +161,10 @@ public class QueryHelp {
break;
case BETWEEN:
List
diff --git a/eladmin-system/src/main/resources/template/email/taskAlarm.ftl b/eladmin-system/src/main/resources/template/email/taskAlarm.ftl
index b116decb..a29b0780 100644
--- a/eladmin-system/src/main/resources/template/email/taskAlarm.ftl
+++ b/eladmin-system/src/main/resources/template/email/taskAlarm.ftl
@@ -60,7 +60,7 @@
font-size: 12px;
padding: 20px 0px;
font-family: Microsoft YaHei;">
- Copyright ©${.now?string("yyyy")}