fix: [exportpdf] fix empty object/attribute/galaxy bugs

pull/358/head
Falconieri 2019-03-01 11:12:04 +01:00
parent b2c5477cd9
commit 1b8921d820
1 changed files with 6 additions and 5 deletions

View File

@ -887,7 +887,7 @@ class Event_Metadata():
# Galaxies # Galaxies
item = ["Related Galaxies", 'Galaxy', "None"] item = ["Related Galaxies", 'Galaxy', "None"]
if is_safe_attribute_table(misp_event, item[1]) : if is_safe_attribute_table(misp_event, item[1]) and is_in_config(self.config, 3):
flowable_table.append(PageBreak()) flowable_table.append(PageBreak())
curr_Galaxy = Galaxy(self.config, self.value_formatter) curr_Galaxy = Galaxy(self.config, self.value_formatter)
flowable_table += curr_Galaxy.get_galaxy_value(misp_event, item) flowable_table += curr_Galaxy.get_galaxy_value(misp_event, item)
@ -1101,7 +1101,7 @@ class Attributes():
# Galaxies # Galaxies
item = ["Related Galaxies", 'Galaxy', "None"] item = ["Related Galaxies", 'Galaxy', "None"]
if is_safe_attribute_table(misp_attribute, item[1]) : if is_safe_attribute_table(misp_attribute, item[1]) and is_in_config(self.config, 3) :
curr_Galaxy = Galaxy(self.config, self.value_formatter) curr_Galaxy = Galaxy(self.config, self.value_formatter)
flowable_table.append(Indenter(left=INDENT_SIZE)) flowable_table.append(Indenter(left=INDENT_SIZE))
flowable_table += curr_Galaxy.get_galaxy_value(misp_attribute, item) flowable_table += curr_Galaxy.get_galaxy_value(misp_attribute, item)
@ -1329,7 +1329,6 @@ class Galaxy():
# item = ["Related Galaxies", 'Galaxy', "None"] # item = ["Related Galaxies", 'Galaxy', "None"]
if is_safe_attribute_table(misp_event, item[1]) and is_in_config(self.config, 3): if is_safe_attribute_table(misp_event, item[1]) and is_in_config(self.config, 3):
galaxy_title = Paragraph(item[0], self.sample_style_sheet['Heading5']) galaxy_title = Paragraph(item[0], self.sample_style_sheet['Heading5'])
flowable_table.append(Indenter(left=INDENT_SIZE_HEADING)) flowable_table.append(Indenter(left=INDENT_SIZE_HEADING))
flowable_table.append(galaxy_title) flowable_table.append(galaxy_title)
flowable_table.append(Indenter(left=-INDENT_SIZE_HEADING)) flowable_table.append(Indenter(left=-INDENT_SIZE_HEADING))
@ -1594,6 +1593,7 @@ def collect_parts(misp_event, config=None):
flowables.append(subtitle) flowables.append(subtitle)
flowables += table_general_metainformation flowables += table_general_metainformation
if is_safe_attribute_table(misp_event, "Attribute") :
flowables.append(PageBreak()) flowables.append(PageBreak())
event_attributes_title = Paragraph("Attributes", sample_style_sheet['Heading2']) event_attributes_title = Paragraph("Attributes", sample_style_sheet['Heading2'])
@ -1601,6 +1601,7 @@ def collect_parts(misp_event, config=None):
flowables.append(event_attributes_title) flowables.append(event_attributes_title)
flowables += table_direct_attributes flowables += table_direct_attributes
if is_safe_attribute_table(misp_event, "Object") :
flowables.append(PageBreak()) flowables.append(PageBreak())
event_objects_title = Paragraph("Objects", sample_style_sheet['Heading2']) event_objects_title = Paragraph("Objects", sample_style_sheet['Heading2'])