Merge remote-tracking branch 'origin/dev-tmp1' into dev-tmp1

dev-tmp1
luotaiqian 2026-08-19 15:16:53 +08:00
commit d7f51723ae
2 changed files with 11 additions and 9 deletions

View File

@ -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);
}

View File

@ -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 {