From 13c770b6beedaee905d99d44bcd5c3378eeda0da Mon Sep 17 00:00:00 2001
From: Awen <39176130+yu1183688986@users.noreply.github.com>
Date: Wed, 27 Oct 2021 19:03:29 +0800
Subject: [PATCH] 优化一些布尔判断语法
---
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