Skip to content

Commit 4904993

Browse files
fix: Licence txt extraction
1 parent 9f65b9e commit 4904993

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sbom2doc/generator.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,14 @@ def generate_document(format, sbom_parser, filename, outfile, include_license):
224224
continue
225225
license_url = f"https://spdx.org/licenses/{key}.json"
226226
try:
227-
license_text = requests.get(license_url).json()
228-
if license_text.get("licenseText") is not None:
227+
license_text = license_info.get_license_text(key)
228+
if len(license_text) > 0:
229229
sbom_document.heading(2, key, number=False)
230-
sbom_document.paragraph(license_text["licenseText"])
230+
sbom_document.paragraph(license_text)
231+
# license_text = requests.get(license_url).json()
232+
# if license_text.get("licenseText") is not None:
233+
# sbom_document.heading(2, key, number=False)
234+
# sbom_document.paragraph(license_text["licenseText"])
231235
except requests.exceptions.RequestException:
232236
sbom_document.heading(2, key, number=False)
233237
sbom_document.paragraph("Unable to find license text.")

0 commit comments

Comments
 (0)