mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 19:51:56 +08:00
解决文件输入流为可能为空的问题
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.file.service;
|
package com.ruoyi.file.service;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.common.utils.IoUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -39,7 +41,7 @@ public class FastDfsSysFileServiceImpl implements ISysFileService
|
|||||||
InputStream inputStream = file.getInputStream();
|
InputStream inputStream = file.getInputStream();
|
||||||
StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(),
|
StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(),
|
||||||
FileTypeUtils.getExtension(file), null);
|
FileTypeUtils.getExtension(file), null);
|
||||||
inputStream.close();
|
IoUtils.closeQuietly(inputStream);
|
||||||
return domain + "/" + storePath.getFullPath();
|
return domain + "/" + storePath.getFullPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user