fix(client): fix file type matching when file or property is null (#5659)

This commit is contained in:
Junyi 2024-11-15 23:02:17 +08:00 committed by GitHub
parent 9a83a4e9b6
commit e65d1887bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,11 +60,14 @@ export class AttachmentFileTypes {
export const attachmentFileTypes = new AttachmentFileTypes();
export function matchMimetype(file: FileModel | UploadFile<any>, type: string) {
if ('originFileObj' in file) {
return match(file.type, type);
if (!file) {
return false;
}
if ('mimetype' in file) {
return match(file.mimetype, type);
if ((<UploadFile>file).originFileObj) {
return match((<UploadFile>file).type, type);
}
if ((<FileModel>file).mimetype) {
return match((<FileModel>file).mimetype, type);
}
if (file.url) {
const [fileUrl] = file.url.split('?');