空文件的判断

This commit is contained in:
xxx 2023-08-02 13:34:18 +08:00
parent d9f3f27d11
commit 5d0af0f51a
2 changed files with 8 additions and 2 deletions

4
.gitignore vendored
View File

@ -32,4 +32,6 @@ deploy-test.sh
deploy-prod.sh
deploy-demo.sh
dist/
dist/
pnpm-lock.yaml

View File

@ -12,7 +12,7 @@ import {
} from "antd";
import Dragger from "antd/es/upload/Dragger";
import { useEffect, useRef, useState } from "react";
import { generateUUID, parseVideo } from "../../utils";
import { generateUUID } from "../../utils";
import { minioMergeVideo, minioUploadId } from "../../api/upload";
import { UploadChunk } from "../../js/minio-upload-chunk";
@ -58,6 +58,10 @@ export const UploadCoursewareButton = (props: PropsInterface) => {
const uploadProps = {
multiple: true,
beforeUpload: async (file: File) => {
if (file.size === 0) {
message.error(`文件 ${file.name} 为空文件`);
return Upload.LIST_IGNORE;
}
let extension: any = file.name.split(".");
extension = extension[extension.length - 1];
if (