Merge remote-tracking branch 'origin/dev-tmp1' into dev-tmp1
commit
d7f51723ae
|
|
@ -61,6 +61,7 @@ public class FileUploadExecutor implements FileUploadApi {
|
|||
if (file == null || file.isEmpty()) {
|
||||
throw new BizException(ErrorCode.FILE_UPLOAD_EMPTY);
|
||||
}
|
||||
// 获取视频时长, 暂时不获取, 直接上传
|
||||
if (!VideoDurationHelper.isVideo(file)) {
|
||||
return doUpload(file, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,15 +40,16 @@ final class VideoDurationHelper {
|
|||
}
|
||||
|
||||
static boolean isVideo(MultipartFile file) {
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
String contentType = file.getContentType();
|
||||
if (StringUtils.hasText(contentType) && contentType.toLowerCase(Locale.ROOT).startsWith("video/")) {
|
||||
return true;
|
||||
}
|
||||
String ext = extractExt(file.getOriginalFilename());
|
||||
return ext != null && VIDEO_EXTS.contains(ext);
|
||||
return false;
|
||||
// if (file == null) {
|
||||
// return false;
|
||||
// }
|
||||
// String contentType = file.getContentType();
|
||||
// if (StringUtils.hasText(contentType) && contentType.toLowerCase(Locale.ROOT).startsWith("video/")) {
|
||||
// return true;
|
||||
// }
|
||||
// String ext = extractExt(file.getOriginalFilename());
|
||||
// return ext != null && VIDEO_EXTS.contains(ext);
|
||||
}
|
||||
|
||||
static Path copyToTemp(MultipartFile file) throws IOException {
|
||||
|
|
|
|||
Loading…
Reference in New Issue