mirror of https://github.com/MISP/PyMISP
parent
524aa13641
commit
74a5d04bda
|
@ -845,11 +845,15 @@ class MISPObject(AbstractMISP):
|
||||||
dictionary with all the keys supported by MISPAttribute"""
|
dictionary with all the keys supported by MISPAttribute"""
|
||||||
if simple_value is not None: # /!\ The value *can* be 0
|
if simple_value is not None: # /!\ The value *can* be 0
|
||||||
value = {'value': simple_value}
|
value = {'value': simple_value}
|
||||||
# Make sure we're not adding an empty value.
|
if value.get('value') is None:
|
||||||
value['value'] = value['value'].strip()
|
logger.warning("The value of the attribute you're trying to add is None, skipping it. Object relation: {}".format(object_relation))
|
||||||
if value.get('value') in [None, '']:
|
|
||||||
logger.warning("The value of the attribute you're trying to add is None or empty string, skipping it. Object relation: {}".format(object_relation))
|
|
||||||
return None
|
return None
|
||||||
|
else:
|
||||||
|
# Make sure we're not adding an empty value.
|
||||||
|
value['value'] = value['value'].strip()
|
||||||
|
if value['value'] == '':
|
||||||
|
logger.warning("The value of the attribute you're trying to add is an empty string, skipping it. Object relation: {}".format(object_relation))
|
||||||
|
return None
|
||||||
if self._known_template and self._definition:
|
if self._known_template and self._definition:
|
||||||
if object_relation in self._definition['attributes']:
|
if object_relation in self._definition['attributes']:
|
||||||
attribute = MISPObjectAttribute(self._definition['attributes'][object_relation])
|
attribute = MISPObjectAttribute(self._definition['attributes'][object_relation])
|
||||||
|
|
Loading…
Reference in New Issue