This repository was archived by the owner on Nov 25, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
core/src/plugins/uploader.html/js/react Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 143
143
let bytesLoaded = computableEvent . loaded ;
144
144
this . setProgress ( percentage , bytesLoaded ) ;
145
145
} . bind ( this ) ;
146
+
146
147
this . setStatus ( 'loading' ) ;
147
148
148
149
let maxUpload = parseFloat ( UploaderConfigs . getInstance ( ) . getOption ( 'UPLOAD_MAX_SIZE' ) ) ;
149
150
150
151
let queryString ;
151
152
try {
153
+ UploaderConfigs . getInstance ( ) . extensionAllowed ( this ) ;
152
154
queryString = this . buildQueryString ( ) ;
153
155
} catch ( e ) {
154
156
this . onError ( e . message ) ;
589
591
}
590
592
}
591
593
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
+
592
605
getOptionAsBool ( name , userPref = '' , defaultValue = undefined ) {
593
606
let o = this . getOption ( name , userPref , defaultValue ) ;
594
607
return ( o === true || o === 'true' ) ;
You can’t perform that action at this time.
0 commit comments