mirror of https://github.com/MISP/PyMISP
fix: Do not fail if the attribute value is not a string
parent
74a5d04bda
commit
1e9eed198e
|
@ -850,10 +850,11 @@ class MISPObject(AbstractMISP):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
# Make sure we're not adding an empty value.
|
# Make sure we're not adding an empty value.
|
||||||
value['value'] = value['value'].strip()
|
if isinstance(value['value'], str):
|
||||||
if value['value'] == '':
|
value['value'] = value['value'].strip()
|
||||||
logger.warning("The value of the attribute you're trying to add is an empty string, skipping it. Object relation: {}".format(object_relation))
|
if value['value'] == '':
|
||||||
return None
|
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