Skip to content

Commit

Permalink
Fixed error where no Description exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
madpeteguy committed Feb 22, 2024
1 parent b1fbf5e commit 06f16a4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions imgdata/scripts/trivy-json-to-junitxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ def main(argv):
name = "[{0}] {1}".format(json_vuln['Severity'], json_vuln['VulnerabilityID'])
classname = "{0}-{1}".format(json_vuln['PkgName'], json_vuln['InstalledVersion'])
tc = xml_testcase(ts, name, classname)
title = ''
if 'Title' in json_vuln:
title = json_vuln['Title']
xml_failure(tc, title, json_vuln['Description'])
title = 'Title' in json_vuln and json_vuln['Title'] or ''
description = 'Description' in json_vuln and json_vuln['Description'] or ''
xml_failure(tc, title, description)
print(f"Save {xml_path}")
(Path.cwd() / os.path.dirname(xml_path)).mkdir(parents=True, exist_ok=True)
xml_file = open(xml_path, "w", encoding="utf-8")
Expand Down

0 comments on commit 06f16a4

Please sign in to comment.