From af8d62e5e20b8a8d131bdf326b7d2304d0a96b88 Mon Sep 17 00:00:00 2001
From: PowderSnow <1109835296@qq.com>
Date: Mon, 13 May 2024 03:21:59 +0800
Subject: [PATCH] update ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java. 目前报”验证码已失效“的场景是uuid为空,应通过判断captcha是否为null得出验证码是否已过期的结果。
---
ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java | 14 +++++++++-----
1 files changed, 9 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 deee22e..989edb7 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,16 +1,18 @@
package com.ruoyi.file.service;
-import org.apache.commons.io.FilenameUtils;
+import java.io.InputStream;
+import com.alibaba.nacos.common.utils.IoUtils;
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 文件存储
- *
+ *
* @author ruoyi
*/
@Service
@@ -27,7 +29,7 @@
/**
* FastDfs文件上传接口
- *
+ *
* @param file 上传的文件
* @return 访问地址
* @throws Exception
@@ -35,8 +37,10 @@
@Override
public String uploadFile(MultipartFile file) throws Exception
{
- StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
- FilenameUtils.getExtension(file.getOriginalFilename()), null);
+ InputStream inputStream = file.getInputStream();
+ StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(),
+ FileTypeUtils.getExtension(file), null);
+ IoUtils.closeQuietly(inputStream);
return domain + "/" + storePath.getFullPath();
}
}
--
Gitblit v1.9.3