Skip to content

Commit

Permalink
improved extension check with js, #411
Browse files Browse the repository at this point in the history
  • Loading branch information
sehmaschine committed Jul 27, 2023
1 parent e5c7fd9 commit 284b16f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions filebrowser/static/filebrowser/js/fileuploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,13 @@ qq.FileUploaderBasic.prototype = {
return name;
},
_isAllowedExtension: function(fileName){
var ext = (-1 !== fileName.indexOf('.')) ? fileName.substr(fileName.lastIndexOf('.')).toLowerCase() : '';
var fileNameLower = fileName.toLowerCase();
var allowed = this._options.allowedExtensions;

if (!allowed.length){return true;}

for (var i=0; i<allowed.length; i++){
if (allowed[i].toLowerCase() == ext){ return true;}
if (fileNameLower.endsWith(allowed[i].toLowerCase())){ return true;}
}

return false;
Expand Down

0 comments on commit 284b16f

Please sign in to comment.