mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 14:39:25 +08:00
fix(client): fix file type matching when file or property is null (#5659)
This commit is contained in:
parent
9a83a4e9b6
commit
e65d1887bd
@ -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('?');
|
||||
|
Loading…
x
Reference in New Issue
Block a user