From 7d5b55fcdc941032c4ff76efe62017b6e8e203b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 4 Jul 2019 16:56:56 +0200 Subject: [PATCH] fix: Skip attribute in object when value is empty, skip empty objects. --- pymisp/tools/csvloader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pymisp/tools/csvloader.py b/pymisp/tools/csvloader.py index 4dc44b7..8f5d6d3 100644 --- a/pymisp/tools/csvloader.py +++ b/pymisp/tools/csvloader.py @@ -45,7 +45,11 @@ class CSVLoader(): for row in reader: tmp_object = MISPObject(self.template_name) + has_attribute = False for object_relation, value in zip(self.fieldnames, row): - tmp_object.add_attribute(object_relation, value=value) - objects.append(tmp_object) + if value: + has_attribute = True + tmp_object.add_attribute(object_relation, value=value) + if has_attribute: + objects.append(tmp_object) return objects