File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
packages/components/file/src/js Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,11 @@ export default class {
3939 const hasTypeError = ! acceptedTypes . some ( ( acceptedType ) => {
4040 const [ type , extension ] = acceptedType . split ( '/' ) ;
4141 if ( extension ) {
42- const isTypeValid = type === '*' || type . toLowerCase ( ) === fileType . toLowerCase ( ) ;
43- const isExtensionValid = extension === '*' || extension . toLowerCase ( ) === fileExtension . toLowerCase ( ) ;
42+ const isTypeValid = type === '*' || type . toLowerCase ( ) === fileType ? .toLowerCase ( ) ;
43+ const isExtensionValid = extension === '*' || extension . toLowerCase ( ) === fileExtension ? .toLowerCase ( ) ;
4444 return isTypeValid && isExtensionValid ;
4545 }
46- return type === '*' || type . replace ( '.' , '' ) . toLowerCase ( ) === fileExtension . toLowerCase ( ) ;
46+ return type === '*' || type . replace ( '.' , '' ) . toLowerCase ( ) === fileExtension ? .toLowerCase ( ) ;
4747 } ) ;
4848 if ( hasTypeError ) {
4949 file . errors . type = true ;
Original file line number Diff line number Diff line change 142142 < span class ="oui-file-ellipsis__size " ng-bind ="file.infos.size "> </ span >
143143 </ span >
144144 < span class ="oui-file-attachments__error "
145- ng-if ="file.errors && file.errors.maxsize "
145+ ng-if ="file.errors.maxsizeError "
146146 ng-bind ="::$ctrl.translations.maxsizeError ">
147147 </ span >
148148 < span class ="oui-file-attachments__error "
149- ng-if ="file.errors && file.errors.notSingle "
149+ ng-if ="file.errors.type "
150+ ng-bind ="::$ctrl.translations.typeError ">
151+ </ span >
152+ < span class ="oui-file-attachments__error "
153+ ng-if ="file.errors.notSingle "
150154 ng-bind ="::$ctrl.translations.notSingleError ">
151155 </ span >
152156 </ span >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export default class {
1414 maxsizeError : 'This file exceeds the size limit' ,
1515 notSingleError : 'You can only add one file' ,
1616 removeFile : 'Remove file from selector' ,
17+ typeError : 'This file extension is not supported' ,
1718 } ;
1819
1920 this . units = [
You can’t perform that action at this time.
0 commit comments