Commit a2c846b0 authored by liqin's avatar liqin 💬

bug fixed

parent a8a0cdd7
...@@ -399,6 +399,14 @@ public class FileUploadController extends BaseController { ...@@ -399,6 +399,14 @@ public class FileUploadController extends BaseController {
if (files == null || files.length == 0) { if (files == null || files.length == 0) {
return getFailResult("没有文件可供上传"); return getFailResult("没有文件可供上传");
} }
if (files.length == 1) {
String extName = FilenameUtils.getExtension(files[0].getOriginalFilename());
boolean anyMatch = Arrays.stream(VIDEO_TYPE).anyMatch(s -> Objects.equals(s, extName.toUpperCase()));
if (!anyMatch) {
return getFailResult("目前仅支持" + String.join("、", VIDEO_TYPE) + "格式");
}
}
final boolean matchChinese = Arrays.stream(files).anyMatch(s -> Objects.requireNonNull(s.getOriginalFilename()).contains("汉语")); final boolean matchChinese = Arrays.stream(files).anyMatch(s -> Objects.requireNonNull(s.getOriginalFilename()).contains("汉语"));
if (!matchChinese) { if (!matchChinese) {
return getFailResult("文件必须包含汉语视频"); return getFailResult("文件必须包含汉语视频");
...@@ -524,6 +532,13 @@ public class FileUploadController extends BaseController { ...@@ -524,6 +532,13 @@ public class FileUploadController extends BaseController {
if (files == null || files.length == 0) { if (files == null || files.length == 0) {
return getFailResult("没有文件可供上传"); return getFailResult("没有文件可供上传");
} }
if (files.length == 1) {
String extName = FilenameUtils.getExtension(files[0].getOriginalFilename());
boolean anyMatch = Arrays.stream(VIDEO_TYPE).anyMatch(s -> Objects.equals(s, extName.toUpperCase()));
if (!anyMatch) {
return getFailResult("目前仅支持" + String.join("、", VIDEO_TYPE) + "格式");
}
}
int successCount = 0; int successCount = 0;
int failureCount = 0; int failureCount = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment