fix(infra):修复文件上传路径生成逻辑- 移除文件路径中不必要的UUID生成
- 直接使用原始文件名构建文件存储路径- 解决信创环境下中文文件名乱码问题 - 确保文件名唯一性由fileService统一处理- 避免因路径不一致导致的文件访问异常
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 + IdUtil.simpleUUID() + (StrUtil.isEmpty(FileUtil.extName(fileName)) ? "" : ("." + FileUtil.extName(fileName)));
|
path = publicPath + fileName;
|
||||||
|
|
||||||
return success(fileService.createFile(fileName, path, IoUtil.readBytes(file.getInputStream())));
|
return success(fileService.createFile(fileName, path, IoUtil.readBytes(file.getInputStream())));
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ public class FileController {
|
|||||||
|
|
||||||
fileName = fileService.getUniqueFileName(fileName, path);
|
fileName = fileService.getUniqueFileName(fileName, path);
|
||||||
// 解决信创环境下文件名中文乱码导致附件错乱的问题
|
// 解决信创环境下文件名中文乱码导致附件错乱的问题
|
||||||
path = publicPath + IdUtil.simpleUUID() + (StrUtil.isEmpty(FileUtil.extName(fileName)) ? "" : ("." + FileUtil.extName(fileName)));
|
path = publicPath + fileName;
|
||||||
|
|
||||||
String fileUrl = fileService.createFile(fileName, path, IoUtil.readBytes(file.getInputStream()));
|
String fileUrl = fileService.createFile(fileName, path, IoUtil.readBytes(file.getInputStream()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user