From 2790e41b5aaea05cb2792e218dfb80f868ccd11a Mon Sep 17 00:00:00 2001 From: anlyyao Date: Tue, 11 Jul 2023 18:53:16 +0800 Subject: [PATCH] fix: resolved types error --- js/upload/utils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/upload/utils.ts b/js/upload/utils.ts index bbfc69a986..676299c348 100644 --- a/js/upload/utils.ts +++ b/js/upload/utils.ts @@ -163,9 +163,11 @@ export function getFileUrlByFileRaw(fileRaw: File): Promise { export function getFileList(files: FileList, accept?: string) { const fileList: File[] = []; for (let i = 0; i < files.length; i++) { - const regExp = new RegExp(accept); - if (regExp.test(files[i].type)) { - fileList.push(files[i]); + if (accept) { + const regExp = new RegExp(accept); + if (regExp.test(files[i].type)) { + fileList.push(files[i]); + } } } return fileList;