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 09139e22..1f018bd6 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 @@ -97,9 +97,13 @@ public RespModel uploadRecord(@RequestParam(name = "file") MultipartFile if (!uuidFolder.exists()) { uuidFolder.mkdirs(); } + String fileName = file.getOriginalFilename(); - String newName = fileName.substring(0, fileName.indexOf(".mp4")) + "-" + index + ".mp4"; - File local = new File(uuidFolder.getPath() + File.separator + newName); + 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); + } RespModel responseModel; try { file.transferTo(local.getAbsoluteFile());