Просмотр исходного кода

修复使用FastDFS上传头像失败提示文件名没有后缀问题

RuoYi лет назад: 3
Родитель
Сommit
8fdb3c4d14

+ 2 - 2
ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java

@@ -1,12 +1,12 @@
1 1
 package com.ruoyi.file.service;
2 2
 
3
-import org.apache.commons.io.FilenameUtils;
4 3
 import org.springframework.beans.factory.annotation.Autowired;
5 4
 import org.springframework.beans.factory.annotation.Value;
6 5
 import org.springframework.stereotype.Service;
7 6
 import org.springframework.web.multipart.MultipartFile;
8 7
 import com.github.tobato.fastdfs.domain.fdfs.StorePath;
9 8
 import com.github.tobato.fastdfs.service.FastFileStorageClient;
9
+import com.ruoyi.common.core.utils.file.FileTypeUtils;
10 10
 
11 11
 /**
12 12
  * FastDFS 文件存储
@@ -36,7 +36,7 @@ public class FastDfsSysFileServiceImpl implements ISysFileService
36 36
     public String uploadFile(MultipartFile file) throws Exception
37 37
     {
38 38
         StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
39
-                FilenameUtils.getExtension(file.getOriginalFilename()), null);
39
+                FileTypeUtils.getExtension(file), null);
40 40
         return domain + "/" + storePath.getFullPath();
41 41
     }
42 42
 }