From 504a4e8e66fe61d7c50f83aa8e3730635f75ebfc Mon Sep 17 00:00:00 2001
From: pigwantacat <zhuhebin0928@163.com>
Date: Thu, 16 Mar 2023 23:48:40 +0800
Subject: [PATCH] 完善ruoyi-file模块的upload接口在文件过大和文件名过长的情况下的返回值中的msg提示信息
---
ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java b/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java
index 202fdab..471b40b 100644
--- a/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java
+++ b/ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java
@@ -1,15 +1,15 @@
package com.ruoyi.file.service;
-import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
+import com.ruoyi.common.core.utils.file.FileTypeUtils;
/**
- * FastDFS文件存储
+ * FastDFS 文件存储
*
* @author ruoyi
*/
@@ -29,15 +29,14 @@
* FastDfs文件上传接口
*
* @param file 上传的文件
- * @param baseDir 相对应用的基目录
* @return 访问地址
* @throws Exception
*/
@Override
- public String uploadFile(MultipartFile file, String baseDir) throws Exception
+ public String uploadFile(MultipartFile file) throws Exception
{
StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
- FilenameUtils.getExtension(file.getOriginalFilename()), null);
+ FileTypeUtils.getExtension(file), null);
return domain + "/" + storePath.getFullPath();
}
}
--
Gitblit v1.9.3