chg: strip NULL string from value

https://github.com/MISP/PyMISP/issues/678
pull/749/head
Raphaël Vinot 2021-03-15 14:09:48 +01:00
parent a2d7cbd763
commit 31608b1480
1 changed files with 2 additions and 2 deletions

View File

@ -917,7 +917,7 @@ class MISPObject(AbstractMISP):
if simple_value is not None: # /!\ The value *can* be 0
value['value'] = simple_value
if value.get('value') is 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))
logger.warning("The value of the attribute you're trying to add is None, skipping it. Object relation: {}".format(object_relation))
return None
else:
if isinstance(value['value'], bytes):
@ -931,7 +931,7 @@ class MISPObject(AbstractMISP):
# Make sure we're not adding an empty value.
if isinstance(value['value'], str):
value['value'] = value['value'].strip()
value['value'] = value['value'].strip().strip('\x00')
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