From 91d395dc71ac846369b46f35466ab0e0f9428460 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 28 Dec 2022 18:05:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E4=B8=8D=E4=BA=86=E5=B9=B3=E5=8F=B0=E4=BA=A4=E4=BA=92?= =?UTF-8?q?jar=E5=8C=85=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复文件管理上传不了平台交互jar包的问题 --- .../java/io/metersphere/commons/utils/FileUtils.java | 11 ----------- .../metadata/repository/MinIOFileRepository.java | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/FileUtils.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/FileUtils.java index d4f84c7ff3..cf08b9aa40 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/FileUtils.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/commons/utils/FileUtils.java @@ -33,17 +33,6 @@ public class FileUtils { public static final String ATTACHMENT_TMP_DIR = "/opt/metersphere/data/attachment/tmp"; public static void validateFileName(String fileName) { - if (StringUtils.isNotEmpty(fileName) && StringUtils.contains(fileName, File.separator)) { - MSException.throwException(Translator.get("invalid_parameter")); - } - } - - /** - * 上传Minio的文件名称检查只需要判断是否带有./ ../ 这样的非法文件名 - * - * @param fileName - */ - public static void validateMinIOFileName(String fileName) { if (StringUtils.isNotEmpty(fileName) && StringUtils.contains(fileName, "." + File.separator)) { MSException.throwException(Translator.get("invalid_parameter")); } diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/repository/MinIOFileRepository.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/repository/MinIOFileRepository.java index cb330a46e2..9f4e5b7c6c 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/repository/MinIOFileRepository.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/metadata/repository/MinIOFileRepository.java @@ -28,7 +28,7 @@ public class MinIOFileRepository implements FileRepository { @Override public String saveFile(MultipartFile file, FileRequest request) throws Exception { - FileUtils.validateMinIOFileName(request.getFileName()); + FileUtils.validateFileName(request.getFileName()); String bucket = minioProperties.getBucket(); String fileName = request.getProjectId() + "/" + request.getFileName(); minioClient.putObject(PutObjectArgs.builder()