mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
优化上传文件的类型识别,增加基于 filename 的读取
This commit is contained in:
parent
30fbfb6143
commit
86bb6f0b80
@ -39,7 +39,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
@Override
|
@Override
|
||||||
public String createFile(String path, byte[] content) throws Exception {
|
public String createFile(String path, byte[] content) throws Exception {
|
||||||
// 计算默认的 path 名
|
// 计算默认的 path 名
|
||||||
String type = FileTypeUtil.getType(new ByteArrayInputStream(content));
|
String type = FileTypeUtil.getType(new ByteArrayInputStream(content), path);
|
||||||
if (StrUtil.isEmpty(path)) {
|
if (StrUtil.isEmpty(path)) {
|
||||||
path = DigestUtil.md5Hex(content) + '.' + type;
|
path = DigestUtil.md5Hex(content) + '.' + type;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user