Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 1a69423

Browse files
committed
Rewire ALLOWED_EXTENSIONS configs - Fix #1283
1 parent b9ed5a7 commit 1a69423

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/src/plugins/uploader.html/js/react/UploaderModel.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@
143143
let bytesLoaded = computableEvent.loaded;
144144
this.setProgress(percentage, bytesLoaded);
145145
}.bind(this);
146+
146147
this.setStatus('loading');
147148

148149
let maxUpload = parseFloat(UploaderConfigs.getInstance().getOption('UPLOAD_MAX_SIZE'));
149150

150151
let queryString;
151152
try{
153+
UploaderConfigs.getInstance().extensionAllowed(this);
152154
queryString = this.buildQueryString();
153155
}catch(e){
154156
this.onError(e.message);
@@ -589,6 +591,17 @@
589591
}
590592
}
591593

594+
extensionAllowed(uploadItem){
595+
let extString = this.getOption("ALLOWED_EXTENSIONS", '', '');
596+
if(!extString) return true;
597+
let extDescription = this.getOption("ALLOWED_EXTENSIONS_READABLE", '', '');
598+
if(extDescription) extDescription = ' (' + extDescription + ')';
599+
let itemExt = PathUtils.getFileExtension(uploadItem.getLabel());
600+
if(extString.split(',').indexOf(itemExt) === -1){
601+
throw new Error(global.pydio.MessageHash[367] + extString + extDescription);
602+
}
603+
}
604+
592605
getOptionAsBool(name, userPref = '', defaultValue = undefined){
593606
let o = this.getOption(name, userPref, defaultValue);
594607
return (o === true || o === 'true');

0 commit comments

Comments
 (0)