优化上传文件的类型识别,增加基于 filename 的读取

pull/2/head
YunaiV 2022-05-27 20:16:25 +08:00
parent 30fbfb6143
commit 86bb6f0b80
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ public class FileServiceImpl implements FileService {
@Override
public String createFile(String path, byte[] content) throws Exception {
// 计算默认的 path 名
String type = FileTypeUtil.getType(new ByteArrayInputStream(content));
String type = FileTypeUtil.getType(new ByteArrayInputStream(content), path);
if (StrUtil.isEmpty(path)) {
path = DigestUtil.md5Hex(content) + '.' + type;
}