Skip to content

Commit 77236d3

Browse files
committed
SBOM file might not have uuid
Problem: Uploading a an SBOM as an attachment may not have a uuid field Solution: Do not create uuid value if it does not exist in SBOM. Signed-off-by: Paul Hewlett <phewlett76@gmail.com>
1 parent 463ccf0 commit 77236d3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

archivist/sboms.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,13 @@ def parse(data: Dict) -> Dict: # pragma: no cover
116116
"author": c["author"],
117117
"component": c["name"],
118118
"supplier": c["supplier"]["name"],
119-
"uuid": b["@serialNumber"],
120119
"version": c["version"],
121120
}
121+
122+
uuid = b.get("@serialNumber")
123+
if uuid is not None:
124+
result["uuid"] = uuid
125+
122126
try:
123127
hash_value = c["hashes"]["hash"]["#text"]
124128
except (TypeError, KeyError):

0 commit comments

Comments
 (0)