Merge pull request #8172 from TriPhoenix/file-upload-allow-whitelist

[FIX] Allow unknown file types if no allowed whitelist has been set (#7074)
pull/8689/head
Rodrigo Nascimento 8 years ago
parent adc895a6a8
commit b3cadfb4ad
No known key found for this signature in database
GPG Key ID: CFCE33B7B01AC335
  1. 10
      packages/rocketchat-lib/lib/fileUploadRestrictions.js
  2. 2
      packages/rocketchat-ui/client/lib/fileUpload.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 = '/*';

@ -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, '.') }`,

Loading…
Cancel
Save