From 79569bd9aa0e51c04fc1fdd6c2c6cc7f9e8d6839 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 22 Nov 2024 09:59:14 +0000 Subject: [PATCH] Fix importing single URLs from CycloneDX --- uswid/format_cyclonedx.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/uswid/format_cyclonedx.py b/uswid/format_cyclonedx.py index a15fc03..9d6b6ba 100644 --- a/uswid/format_cyclonedx.py +++ b/uswid/format_cyclonedx.py @@ -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)