mirror of https://github.com/MISP/MISP
fix: Attribute values that are too long for mysql text fields don't generate warnings and just truncate, fixes #3196
added validation errorpull/3233/head
parent
6740165cf1
commit
47df2d5c61
|
@ -420,6 +420,9 @@ class Attribute extends AppModel {
|
|||
'validComposite' => array(
|
||||
'rule' => array('validComposite'),
|
||||
'message' => 'Composite type found but the value not in the composite (value1|value2) format.'
|
||||
),
|
||||
'maxTextLength' => array(
|
||||
'rule' => array('maxTextLength')
|
||||
)
|
||||
),
|
||||
'to_ids' => array(
|
||||
|
@ -734,6 +737,13 @@ class Attribute extends AppModel {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function maxTextLength($fields) {
|
||||
if (strlen($fields['value']) > 65535) {
|
||||
return 'The entered string is too long and would get truncated. Please consider adding the data as an attachment instead';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function validCategory($fields) {
|
||||
$validCategories = array_keys($this->categoryDefinitions);
|
||||
if (in_array($fields['category'], $validCategories)) return true;
|
||||
|
|
Loading…
Reference in New Issue