Skip to content

Commit

Permalink
bug: Correct handling of CycloneDX license data in XML documents
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyharrison committed Oct 6, 2022
1 parent dfbee0a commit 8f9eb2e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sbomdiff/cyclonedx_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ def parse_cyclonedx_xml(self, sbom_file):
if component_version is None:
raise KeyError(f"Could not find version in {component}")
version = component_version.text
component_license = component.find(schema + "license")
if component_license is None:
license = "NOT FOUND"
else:
license = component_license.text
license = "NOT FOUND"
component_license = component.find(schema + "licenses")
if component_license is not None:
license_data = component_license.find(schema + "expression")
if license_data is not None:
license = license_data.text
if version is not None:
if package not in packages:
packages[package] = [version, license]
Expand Down

0 comments on commit 8f9eb2e

Please sign in to comment.