fix(infra):修复文件上传路径生成逻辑
- 修改文件名生成方式,使用UUID确保唯一性 -保留原文件扩展名,避免文件类型丢失 - 确保文件路径包含完整文件名和扩展名
This commit is contained in:
@@ -67,7 +67,7 @@ public class FileController {
|
|||||||
String path = publicPath + fileName;
|
String path = publicPath + fileName;
|
||||||
|
|
||||||
fileName = fileService.getUniqueFileName(fileName, path);
|
fileName = fileService.getUniqueFileName(fileName, path);
|
||||||
path = publicPath + fileName;
|
path = publicPath + IdUtil.simpleUUID() + (StrUtil.isEmpty(FileUtil.extName(fileName)) ? "" : ("." + FileUtil.extName(fileName)));
|
||||||
|
|
||||||
return success(fileService.createFile(fileName, path, IoUtil.readBytes(file.getInputStream())));
|
return success(fileService.createFile(fileName, path, IoUtil.readBytes(file.getInputStream())));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user