From 90f3bddfc22c72832d10a624a3cd543a5ce52c07 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期五, 24 十二月 2021 12:00:39 +0800
Subject: [PATCH] 升级oshi到最新版本v5.8.6
---
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