From 17550a5f4bd152bb67a0de2c1284e2eef243777c Mon Sep 17 00:00:00 2001 From: Remenber_Ray <343509740@qq.com> Date: 星期日, 24 十月 2021 10:34:25 +0800 Subject: [PATCH] update ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java. 修复描述错误 --- ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index daa9498..76b647a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -127,18 +127,21 @@ return fileName; } - private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException + public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException { File desc = new File(uploadDir + File.separator + fileName); - if (!desc.exists()) { - if (!desc.getParentFile().exists()) { + + if (!desc.exists()) + { + if (!desc.getParentFile().exists()) + { desc.getParentFile().mkdirs(); } } return desc; } - private static final String getPathFileName(String uploadDir, String fileName) throws IOException + public static final String getPathFileName(String uploadDir, String fileName) throws IOException { int dirLastIndex = RuoYiConfig.getProfile().length() + 1; String currentDir = StringUtils.substring(uploadDir, dirLastIndex); @@ -182,6 +185,11 @@ throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, fileName); } + else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) + { + throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, + fileName); + } else { throw new InvalidExtensionException(allowedExtension, extension, fileName); -- Gitblit v1.9.2