diff --git a/packages/core/client/src/schema-component/antd/upload/shared.ts b/packages/core/client/src/schema-component/antd/upload/shared.ts index c95605396d..ef3ac67cd0 100644 --- a/packages/core/client/src/schema-component/antd/upload/shared.ts +++ b/packages/core/client/src/schema-component/antd/upload/shared.ts @@ -60,11 +60,14 @@ export class AttachmentFileTypes { export const attachmentFileTypes = new AttachmentFileTypes(); export function matchMimetype(file: FileModel | UploadFile, 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 ((file).originFileObj) { + return match((file).type, type); + } + if ((file).mimetype) { + return match((file).mimetype, type); } if (file.url) { const [fileUrl] = file.url.split('?');