Skip to content

Commit

Permalink
Fix importing single URLs from CycloneDX
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsie committed Nov 22, 2024
1 parent 45ad4b3 commit 79569bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion uswid/format_cyclonedx.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def _convert_entity_from_dict(data: Dict[str, Any]) -> uSwidEntity:
if isinstance(data, list):
raise NotSupportedError("multiple entities not expected")
try:
regid = data.get("url", [])[0]
regid = data.get("url")
if isinstance(regid, list):
regid = regid[0]
except IndexError:
regid = None
return uSwidEntity(name=data.get("name"), regid=regid)
Expand Down

0 comments on commit 79569bd

Please sign in to comment.