From 524aa13641e35bcc99963149a9caa71e0d271d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 29 May 2020 00:56:28 +0200 Subject: [PATCH] fix: Properly strip value in MISPObject.add_attribute Fix #546 --- pymisp/mispevent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index 49829a4..38043ce 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -845,6 +845,8 @@ class MISPObject(AbstractMISP): dictionary with all the keys supported by MISPAttribute""" if simple_value is not None: # /!\ The value *can* be 0 value = {'value': simple_value} + # Make sure we're not adding an empty value. + value['value'] = value['value'].strip() 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