From bf4ac3ad7a20fadd5aaa92ea0b6abde452c232ee Mon Sep 17 00:00:00 2001
From: 若依 <yzz_ivy@163.com>
Date: 星期二, 30 十一月 2021 11:03:08 +0800
Subject: [PATCH] !378 fix: crontab组件bug Merge pull request !378 from fuzui/fix_cron_tool
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 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 183f918..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
@@ -15,7 +15,7 @@
/**
* 文件上传工具类
- *
+ *
* @author ruoyi
*/
public class FileUploadUtils
@@ -89,7 +89,7 @@
*
* @param baseDir 相对应用的基目录
* @param file 上传的文件
- * @param extension 上传文件类型
+ * @param allowedExtension 上传文件类型
* @return 返回上传成功的文件名
* @throws FileSizeLimitExceededException 如果超出最大大小
* @throws FileNameLengthLimitExceededException 文件名太长
@@ -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);
@@ -215,7 +219,7 @@
/**
* 获取文件名的后缀
- *
+ *
* @param file 表单文件
* @return 后缀名
*/
@@ -228,4 +232,4 @@
}
return extension;
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.2