Browse Source

fix error when file.type === null, shouldn’t pass that to match

Artur Paikin 7 years ago
parent
commit
bbe3083276
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/core/Core.js

+ 5 - 1
src/core/Core.js

@@ -301,7 +301,11 @@ class Uppy {
     }
 
     if (allowedFileTypes) {
-      const isCorrectFileType = allowedFileTypes.filter(match(file.type)).length > 0
+      const isCorrectFileType = allowedFileTypes.filter((type) => {
+        if (!file.type) return false
+        return match(file.type, type)
+      }).length > 0
+
       if (!isCorrectFileType) {
         const allowedFileTypesString = allowedFileTypes.join(', ')
         this.info(`${this.i18n('youCanOnlyUploadFileTypes')} ${allowedFileTypesString}`, 'error', 5000)