mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
catch custom fields that are arrays
This commit is contained in:
parent
74ed32903f
commit
388e4c10c4
|
@ -530,7 +530,6 @@ class AssetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param \App\Http\Requests\ImageUploadRequest $request
|
||||
* @since [v4.0]
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
{
|
||||
|
@ -579,6 +578,10 @@ class AssetsController extends Controller
|
|||
|
||||
if (($model) && ($model->fieldset)) {
|
||||
foreach ($model->fieldset->fields as $field) {
|
||||
//reduce "array to string conversion" exceptions - ideally we'd handle this in a form request, but this works for now
|
||||
if(is_array($request->input($field->db_column, null))) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'This custom field can not be an array', 200));
|
||||
}
|
||||
|
||||
// Set the field value based on what was sent in the request
|
||||
$field_val = $request->input($field->db_column, null);
|
||||
|
|
|
@ -220,10 +220,6 @@ class Asset extends Depreciable
|
|||
}
|
||||
}
|
||||
|
||||
if (!is_array($params)){
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::save($params);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue