Skip to content

Commit

Permalink
Merge pull request #463 from ColonelThirtyTwo/fix-xlsx-evidence
Browse files Browse the repository at this point in the history
Fix evidence references in XLSX exports
  • Loading branch information
chrismaddalena authored Jun 17, 2024
2 parents c4b79ca + 0074f2b commit 1c1be55
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ghostwriter/modules/reportwriter/richtext/plain_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ def _build_html_str(node, evidences, out: StringIO):
return

if node.name == "span" and "data-gw-evidence" in node.attrs:
evidence = evidences.get(node.attrs["data-gw-evidence"])
if evidence is not None:
out.write(
f"\n<See Report for Evidence File: {evidence['friendly_name']}>\nCaption \u2013 {evidence['caption']}"
)
try:
evidence = evidences[int(node.attrs["data-gw-evidence"])]
except (KeyError, ValueError):
return
out.write(
f"\n<See Report for Evidence File: {evidence['friendly_name']}>\nCaption \u2013 {evidence['caption']}"
)
return
elif node.name == "span" and "data-gw-caption" in node.attrs:
ref_name = node.attrs["data-gw-caption"]
if ref_name:
Expand Down

0 comments on commit 1c1be55

Please sign in to comment.