This repository was archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
Empty validation message for file input when sent array for file input #184
Copy link
Copy link
Closed
Description
Let's say I have an FileInput type input field.
..,
[
'required' => false,
'validators' => [
0 => [
'name' => \Zend\Validator\File\UploadFile::class,
'options' => [],
],
1 => [
'name' => \Zend\Validator\File\Size::class,
'options' => [
'max ' => '1MB',
],
],
2 => [
'name' => \Zend\Validator\File\MimeType::class,
'options' => [
'mimeType' => 'image/jpg, image/jpeg, image/png, image/gif, image/bmp',
],
],
3 => [
'name' => \Zend\Validator\File\ImageSize::class,
'options' => [
'minWidth' => 50,
'minHeight' => 50,
'maxWidth' => 2048,
'maxHeight' => 2048,
],
],
],
'filters' => [],
'name' => 'logo',
'description' => 'logo image file',
'field_type' => 'file',
'type' => \Zend\InputFilter\FileInput::class,
'continue_if_empty' => true,
]And I send
logo[] = 'test'
The response should be
{
"validation_messages": {
"logo": {
"fileUploadFileErrorNoFile": "No file was uploaded",
"fileSizeNotFound": "File is not readable or does not exist",
"fileMimeTypeNotReadable": "File is not readable or does not exist",
"fileImageSizeNotReadable": "File is not readable or does not exist"
}
},
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Unprocessable Entity",
"status": 422,
"detail": "Failed Validation"
}
But response is this.
{
"validation_messages": {
"logo": []
},
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Unprocessable Entity",
"status": 422,
"detail": "Failed Validation"
}