From 85dc7fe158aff18cb3b7d07ea3caf68103114801 Mon Sep 17 00:00:00 2001 From: zhouyl <583641232@qq.com> Date: Sun, 11 Aug 2024 16:44:07 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=B5=8B=E8=AF=95=E5=8C=85?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/file/FileUploadUtils.java | 10 +++++++--- .../system/runner/SystemApplicationRunner.java | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tp-common/src/main/java/com/inscloudtech/common/utils/file/FileUploadUtils.java b/tp-common/src/main/java/com/inscloudtech/common/utils/file/FileUploadUtils.java index 6971f7e..381f605 100644 --- a/tp-common/src/main/java/com/inscloudtech/common/utils/file/FileUploadUtils.java +++ b/tp-common/src/main/java/com/inscloudtech/common/utils/file/FileUploadUtils.java @@ -1,5 +1,6 @@ package com.inscloudtech.common.utils.file; +import cn.hutool.core.util.StrUtil; import com.inscloudtech.common.config.ProjectConfig; import com.inscloudtech.common.constant.Constants; import com.inscloudtech.common.exception.file.FileNameLengthLimitExceededException; @@ -107,7 +108,7 @@ public class FileUploadUtils { throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); } - assertAllowed(file, allowedExtension); +// assertAllowed(file, allowedExtension); String fileName = extractFilename(file); @@ -235,7 +236,10 @@ public class FileUploadUtils { String[] allowedExtension = MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION; String fileName = file.getOriginalFilename(); String extension = getExtension(file); - if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) { + if(StrUtil.isEmpty(extension)){ + return false; + } +/* if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) { if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) { return false; // throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, @@ -256,7 +260,7 @@ public class FileUploadUtils { // throw new InvalidExtensionException(allowedExtension, extension, fileName); return false; } - } + }*/ return true; } diff --git a/tp-system/src/main/java/com/inscloudtech/system/runner/SystemApplicationRunner.java b/tp-system/src/main/java/com/inscloudtech/system/runner/SystemApplicationRunner.java index 245c9f4..b544b9e 100644 --- a/tp-system/src/main/java/com/inscloudtech/system/runner/SystemApplicationRunner.java +++ b/tp-system/src/main/java/com/inscloudtech/system/runner/SystemApplicationRunner.java @@ -28,7 +28,7 @@ public class SystemApplicationRunner implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { ossConfigService.init(); - log.info("初始化OSS配置成功"); +// log.info("初始化OSS配置成功"); if (ruoyiConfig.isCacheLazy()) { return; }