mirror of https://github.com/MISP/PyMISP
fix: Skip attribute in object when value is empty, skip empty objects.
parent
cb1f345908
commit
7d5b55fcdc
|
@ -45,7 +45,11 @@ class CSVLoader():
|
||||||
|
|
||||||
for row in reader:
|
for row in reader:
|
||||||
tmp_object = MISPObject(self.template_name)
|
tmp_object = MISPObject(self.template_name)
|
||||||
|
has_attribute = False
|
||||||
for object_relation, value in zip(self.fieldnames, row):
|
for object_relation, value in zip(self.fieldnames, row):
|
||||||
tmp_object.add_attribute(object_relation, value=value)
|
if value:
|
||||||
objects.append(tmp_object)
|
has_attribute = True
|
||||||
|
tmp_object.add_attribute(object_relation, value=value)
|
||||||
|
if has_attribute:
|
||||||
|
objects.append(tmp_object)
|
||||||
return objects
|
return objects
|
||||||
|
|
Loading…
Reference in New Issue