diff --git a/packages/rocketchat-lib/lib/fileUploadRestrictions.js b/packages/rocketchat-lib/lib/fileUploadRestrictions.js index 26f798078e01..41290c9a7298 100644 --- a/packages/rocketchat-lib/lib/fileUploadRestrictions.js +++ b/packages/rocketchat-lib/lib/fileUploadRestrictions.js @@ -11,7 +11,15 @@ RocketChat.fileUploadMediaWhiteList = function() { RocketChat.fileUploadIsValidContentType = function(type) { const list = RocketChat.fileUploadMediaWhiteList(); - if (!list || _.contains(list, type)) { + if (!list) { + return true; + } + + if (!type) { + return false; + } + + if (_.contains(list, type)) { return true; } else { const wildCardGlob = '/*'; diff --git a/packages/rocketchat-ui/client/lib/fileUpload.js b/packages/rocketchat-ui/client/lib/fileUpload.js index e13ca4809382..870b5be71e01 100644 --- a/packages/rocketchat-ui/client/lib/fileUpload.js +++ b/packages/rocketchat-ui/client/lib/fileUpload.js @@ -56,7 +56,7 @@ fileUpload = function(filesToUpload) { return; } - if (!file.file.type || !RocketChat.fileUploadIsValidContentType(file.file.type)) { + if (!RocketChat.fileUploadIsValidContentType(file.file.type)) { swal({ title: t('FileUpload_MediaType_NotAccepted'), text: file.file.type || `*.${ s.strRightBack(file.file.name, '.') }`,