mirror of https://github.com/MISP/MISP
fix: Ugly fix for the float issues
parent
a096449631
commit
396eecd242
|
@ -133,7 +133,6 @@ class ObjectsController extends AppController {
|
||||||
if (empty($template)) {
|
if (empty($template)) {
|
||||||
$error = 'No valid template found to edit the object.';
|
$error = 'No valid template found to edit the object.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have received a POST request
|
// If we have received a POST request
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
if (isset($this->request->data['request'])) {
|
if (isset($this->request->data['request'])) {
|
||||||
|
@ -195,7 +194,7 @@ class ObjectsController extends AppController {
|
||||||
// In the case of a GET request or if the object could not be validated, show the form / the requirement
|
// In the case of a GET request or if the object could not be validated, show the form / the requirement
|
||||||
if ($this->_isRest()) {
|
if ($this->_isRest()) {
|
||||||
if ($error) {
|
if ($error) {
|
||||||
|
return $this->RestResponse->saveFailResponse('objects', 'add', $eventId . '/' . $templateId, $error, $this->response->type());
|
||||||
} else {
|
} else {
|
||||||
return $this->RestResponse->viewData($orgs, $this->response->type());
|
return $this->RestResponse->viewData($orgs, $this->response->type());
|
||||||
}
|
}
|
||||||
|
|
|
@ -659,7 +659,7 @@ class Attribute extends AppModel {
|
||||||
}
|
}
|
||||||
// TODO: add explanatory comment
|
// TODO: add explanatory comment
|
||||||
$result = $this->runRegexp($this->data['Attribute']['type'], $this->data['Attribute']['value']);
|
$result = $this->runRegexp($this->data['Attribute']['type'], $this->data['Attribute']['value']);
|
||||||
if (!$result) {
|
if ($result === false) {
|
||||||
$this->invalidate('value', 'This value is blocked by a regular expression in the import filters.');
|
$this->invalidate('value', 'This value is blocked by a regular expression in the import filters.');
|
||||||
} else {
|
} else {
|
||||||
$this->data['Attribute']['value'] = $result;
|
$this->data['Attribute']['value'] = $result;
|
||||||
|
@ -683,8 +683,9 @@ class Attribute extends AppModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->data['Attribute']['distribution'] != 4) $this->data['Attribute']['sharing_group_id'] = 0;
|
if ($this->data['Attribute']['distribution'] != 4) $this->data['Attribute']['sharing_group_id'] = 0;
|
||||||
|
|
||||||
// return true, otherwise the object cannot be saved
|
// return true, otherwise the object cannot be saved
|
||||||
|
|
||||||
|
if ($this->data['Attribute']['type'] == 'float' && $this->data['Attribute']['value'] == 0) $this->data['Attribute']['value'] = '0.0';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class RegexpBehavior extends ModelBehavior {
|
||||||
|
|
||||||
private $__allRegexp = array();
|
private $__allRegexp = array();
|
||||||
|
|
||||||
public $excluded_types = array('sigma');
|
public $excluded_types = array('sigma', 'float');
|
||||||
|
|
||||||
public function setup(Model $model, $config = null) {
|
public function setup(Model $model, $config = null) {
|
||||||
$regexp = new Regexp();
|
$regexp = new Regexp();
|
||||||
|
|
Loading…
Reference in New Issue