perf:文件上传保留后缀
This commit is contained in:
@@ -108,8 +108,8 @@ public class ToolController {
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/chunk_merge")
|
||||
public ApiResp<String> fileChunkMerge(String fileMd5) {
|
||||
String path = fileUploadService.chunkMerge(fileMd5);
|
||||
public ApiResp<String> fileChunkMerge(String fileMd5, String fileExt) {
|
||||
String path = fileUploadService.chunkMerge(fileMd5, fileExt);
|
||||
return ApiResp.respOK(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class FileUploadService {
|
||||
String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename());
|
||||
tieshengWebConfigurer.uploadFileCheck(fileType);
|
||||
|
||||
FileUploadPath filePath = FileUploadPath.random();
|
||||
FileUploadPath filePath = FileUploadPath.random(fileType);
|
||||
|
||||
InputStream stream = file.getInputStream();
|
||||
FileUtil.writeFromStream(stream, filePath.getAbsolutePath());
|
||||
@@ -107,7 +107,7 @@ public class FileUploadService {
|
||||
*
|
||||
* @param fileMd5
|
||||
*/
|
||||
public String chunkMerge(String fileMd5) {
|
||||
public String chunkMerge(String fileMd5, String fileExt) {
|
||||
|
||||
// 1,获取文件块的目录
|
||||
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
||||
@@ -118,7 +118,7 @@ public class FileUploadService {
|
||||
}
|
||||
|
||||
// 3,生成保存文件的路径
|
||||
FileUploadPath uploadPath = FileUploadPath.random();
|
||||
FileUploadPath uploadPath = FileUploadPath.random(fileExt);
|
||||
|
||||
// 4,获取块文件,此列表是已经排好序的列表
|
||||
List<File> chunkFiles = getSortedChunkFiles(new File(folder.getAbsolutePath()));
|
||||
|
||||
Reference in New Issue
Block a user