|
|
@@ -1,6 +1,9 @@
|
|
|
package cn.iocoder.yudao.module.infra.controller.admin.file.vo.file;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
+import jakarta.validation.constraints.AssertTrue;
|
|
|
import jakarta.validation.constraints.NotNull;
|
|
|
import lombok.Data;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@@ -16,4 +19,10 @@ public class FileUploadReqVO {
|
|
|
@Schema(description = "文件目录", example = "XXX/YYY")
|
|
|
private String directory;
|
|
|
|
|
|
+ @AssertTrue(message = "文件目录不正确")
|
|
|
+ @JsonIgnore
|
|
|
+ public boolean isDirectoryValid() {
|
|
|
+ return !StrUtil.containsAny(directory, "..", "/", "\\");
|
|
|
+ }
|
|
|
+
|
|
|
}
|