Commit 86bb6f0b802c6596a5fb3ead8548e55309175a45

Authored by YunaiV
1 parent 30fbfb61

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

yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java
... ... @@ -39,7 +39,7 @@ public class FileServiceImpl implements FileService {
39 39 @Override
40 40 public String createFile(String path, byte[] content) throws Exception {
41 41 // 计算默认的 path 名
42   - String type = FileTypeUtil.getType(new ByteArrayInputStream(content));
  42 + String type = FileTypeUtil.getType(new ByteArrayInputStream(content), path);
43 43 if (StrUtil.isEmpty(path)) {
44 44 path = DigestUtil.md5Hex(content) + '.' + type;
45 45 }
... ...