mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge pull request #10315 from snipe/fixes/escape_custom_fields_in_api_response
Escape custom field values in API response
This commit is contained in:
commit
7ce5993f5a
|
@ -93,15 +93,15 @@ class AssetsTransformer
|
||||||
$value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
|
$value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||||
|
|
||||||
$fields_array[$field->name] = [
|
$fields_array[$field->name] = [
|
||||||
'field' => $field->convertUnicodeDbSlug(),
|
'field' => e($field->convertUnicodeDbSlug()),
|
||||||
'value' => $value,
|
'value' => e($value),
|
||||||
'field_format' => $field->format,
|
'field_format' => $field->format,
|
||||||
];
|
];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$fields_array[$field->name] = [
|
$fields_array[$field->name] = [
|
||||||
'field' => $field->convertUnicodeDbSlug(),
|
'field' => e($field->convertUnicodeDbSlug()),
|
||||||
'value' => $asset->{$field->convertUnicodeDbSlug()},
|
'value' => e($asset->{$field->convertUnicodeDbSlug()}),
|
||||||
'field_format' => $field->format,
|
'field_format' => $field->format,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ class AssetsTransformer
|
||||||
|
|
||||||
'id' => $component->id,
|
'id' => $component->id,
|
||||||
'pivot_id' => $component->pivot->id,
|
'pivot_id' => $component->pivot->id,
|
||||||
'name' => $component->name,
|
'name' => e($component->name),
|
||||||
'qty' => $component->pivot->assigned_qty,
|
'qty' => $component->pivot->assigned_qty,
|
||||||
'price_cost' => $component->purchase_cost,
|
'price_cost' => $component->purchase_cost,
|
||||||
'purchase_total' => $component->purchase_cost * $component->pivot->assigned_qty,
|
'purchase_total' => $component->purchase_cost * $component->pivot->assigned_qty,
|
||||||
|
|
Loading…
Reference in a new issue