From dbc4616dc648d25b3a1e3792f2e53b125ccfdc00 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期一, 20 九月 2021 18:56:43 +0800 Subject: [PATCH] reset dataSourceAspect --- src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 5b356e2..afed94d 100644 --- a/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -127,22 +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.getParentFile().exists()) - { - desc.getParentFile().mkdirs(); - } if (!desc.exists()) { - desc.createNewFile(); + 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); @@ -186,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.3