Skip to content

Commit

Permalink
fix: missing check for Classifiers in Environment Parser
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Horton <phorton@sonatype.com>
  • Loading branch information
madpah committed Oct 19, 2021
1 parent d45f75b commit b7fa38e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cyclonedx/parser/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ def __init__(self):
if 'License' in i_metadata.keys() and i_metadata.get('License') != 'UNKNOWN':
c.set_license(license_str=i_metadata.get('License'))

for classifier in i_metadata.get_all('Classifier'):
if str(classifier).startswith('License :: OSI Approved :: '):
c.set_license(license_str=str(classifier).replace('License :: OSI Approved :: ', '').strip())
if 'Classifier' in i_metadata.keys():
for classifier in i_metadata.get_all('Classifier'):
if str(classifier).startswith('License :: OSI Approved :: '):
c.set_license(license_str=str(classifier).replace('License :: OSI Approved :: ', '').strip())

self._components.append(c)

Expand Down

0 comments on commit b7fa38e

Please sign in to comment.