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 {
39
39
const hasTypeError = ! acceptedTypes . some ( ( acceptedType ) => {
40
40
const [ type , extension ] = acceptedType . split ( '/' ) ;
41
41
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 ( ) ;
44
44
return isTypeValid && isExtensionValid ;
45
45
}
46
- return type === '*' || type . replace ( '.' , '' ) . toLowerCase ( ) === fileExtension . toLowerCase ( ) ;
46
+ return type === '*' || type . replace ( '.' , '' ) . toLowerCase ( ) === fileExtension ? .toLowerCase ( ) ;
47
47
} ) ;
48
48
if ( hasTypeError ) {
49
49
file . errors . type = true ;
Original file line number Diff line number Diff line change 142
142
< span class ="oui-file-ellipsis__size " ng-bind ="file.infos.size "> </ span >
143
143
</ span >
144
144
< span class ="oui-file-attachments__error "
145
- ng-if ="file.errors && file.errors.maxsize "
145
+ ng-if ="file.errors.maxsizeError "
146
146
ng-bind ="::$ctrl.translations.maxsizeError ">
147
147
</ span >
148
148
< 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 "
150
154
ng-bind ="::$ctrl.translations.notSingleError ">
151
155
</ span >
152
156
</ span >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export default class {
14
14
maxsizeError : 'This file exceeds the size limit' ,
15
15
notSingleError : 'You can only add one file' ,
16
16
removeFile : 'Remove file from selector' ,
17
+ typeError : 'This file extension is not supported' ,
17
18
} ;
18
19
19
20
this . units = [
You can’t perform that action at this time.
0 commit comments