From 1e9eed198eba65d829d7211b6d5fea3d435b169e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 29 May 2020 01:23:34 +0200 Subject: [PATCH] fix: Do not fail if the attribute value is not a string --- pymisp/mispevent.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index eff30b1..bd0b386 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -850,10 +850,11 @@ class MISPObject(AbstractMISP): 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 isinstance(value['value'], str): + 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 object_relation in self._definition['attributes']: attribute = MISPObjectAttribute(self._definition['attributes'][object_relation])