Commit b3f0f7dc by Tomek Romik Committed by Qiang Xue

Fixed typo and inconsistent conditionals

parent d1c2b137
...@@ -98,7 +98,7 @@ yii.validation = (function ($) { ...@@ -98,7 +98,7 @@ yii.validation = (function ($) {
} }
if ( !~options.extensions.indexOf(ext) ) { if ( !~options.extensions.indexOf(ext) ) {
pub.addMessage(messages, options.wrongExtension, file); pub.addMessage(messages, options.wrongExtension, file.name);
} }
} }
......
...@@ -342,14 +342,14 @@ class FileValidator extends Validator ...@@ -342,14 +342,14 @@ class FileValidator extends Validator
$options['uploadRequired'] = Yii::$app->getI18n()->format($this->uploadRequired, [], Yii::$app->language); $options['uploadRequired'] = Yii::$app->getI18n()->format($this->uploadRequired, [], Yii::$app->language);
} }
if ( is_array($this->mimeTypes) ) { if ( $this->mimeTypes !== null ) {
$options['mimeTypes'] = $this->mimeTypes; $options['mimeTypes'] = $this->mimeTypes;
$options['wrongMimeType'] = Yii::$app->getI18n()->format($this->wrongMimeType, [ $options['wrongMimeType'] = Yii::$app->getI18n()->format($this->wrongMimeType, [
'mimeTypes' => join(', ', $this->mimeTypes) 'mimeTypes' => join(', ', $this->mimeTypes)
], Yii::$app->language); ], Yii::$app->language);
} }
if ( !empty($this->extensions) ) { if ( $this->extensions !== null ) {
$options['extensions'] = $this->extensions; $options['extensions'] = $this->extensions;
$options['wrongExtension'] = Yii::$app->getI18n()->format($this->wrongExtension, [ $options['wrongExtension'] = Yii::$app->getI18n()->format($this->wrongExtension, [
'extensions' => join(', ', $this->extensions) 'extensions' => join(', ', $this->extensions)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment