fix: Skip attribute in object when value is empty, skip empty objects.

pull/418/head
Raphaël Vinot 2019-07-04 16:56:56 +02:00
parent cb1f345908
commit 7d5b55fcdc
1 changed files with 6 additions and 2 deletions

View File

@ -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