解决文件输入流为可能为空的问题

zmy
maochd 2023-04-18 13:55:07 +08:00
parent 49e6fbf2ff
commit 3786f3671d
1 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package com.ruoyi.file.service;
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;
@ -39,7 +41,7 @@ public class FastDfsSysFileServiceImpl implements ISysFileService
InputStream inputStream = file.getInputStream();
StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(),
FileTypeUtils.getExtension(file), null);
inputStream.close();
IoUtils.closeQuietly(inputStream);
return domain + "/" + storePath.getFullPath();
}
}