From 762f187d577deaa8825eb861c9a60ed2f07f649f Mon Sep 17 00:00:00 2001 From: Eason <291028775@qq.com> Date: Tue, 14 May 2024 11:12:20 +0800 Subject: [PATCH] Update UploadController.java Signed-off-by: Eason <291028775@qq.com> --- .../sonic/folder/controller/UploadController.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sonic-server-folder/src/main/java/org/cloud/sonic/folder/controller/UploadController.java b/sonic-server-folder/src/main/java/org/cloud/sonic/folder/controller/UploadController.java index 1f018bd6..cdf0bdb2 100644 --- a/sonic-server-folder/src/main/java/org/cloud/sonic/folder/controller/UploadController.java +++ b/sonic-server-folder/src/main/java/org/cloud/sonic/folder/controller/UploadController.java @@ -99,11 +99,12 @@ public RespModel uploadRecord(@RequestParam(name = "file") MultipartFile } String fileName = file.getOriginalFilename(); - if (fileName != null) { - fileName = new File(fileName).getName(); - String newName = fileName.substring(0, fileName.indexOf(".mp4")) + "-" + index + ".mp4"; - File local = new File(uuidFolder.getPath() + File.separator + newName); - } + if (fileName == null) { + return new RespModel(RespEnum.UPLOAD_FAIL); + } + fileName = new File(fileName).getName(); + String newName = fileName.substring(0, fileName.indexOf(".mp4")) + "-" + index + ".mp4"; + File local = new File(uuidFolder.getPath() + File.separator + newName); RespModel responseModel; try { file.transferTo(local.getAbsoluteFile());