Skip to content

Commit f5eb1ab

Browse files
committed
Remove / from image SPDX Identifier Reference
Currently, Tern uses image_name-tag or image_name-checksum to render a human readable ID for an image's SPDXRef in SPDX documents. This is problematic when there is a `/` character in the image name, in which case, the SPDX document fails to verify because the SPDXRef does not meet the SPDX Identifier Reference requirements [1]. This commit replaces the `/` character in an image name with a `-`. [1] https://spdx.github.io/spdx-spec/8-annotations/#84-spdx-identifier-reference Signed-off-by: Rose Judge <[email protected]>
1 parent 4c4b2a8 commit f5eb1ab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tern/classes/image.py

+3
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ def get_human_readable_id(self):
184184
and this is currently not supported by any image tool. So using
185185
a combination of name and tag or name and checksum instead'''
186186
name = self.name
187+
# SPDX does not allow '/' character to be used in SPDX ID References
188+
if "/" in self.name:
189+
name = name.replace("/", "-")
187190
if self.tag:
188191
name = name + '-{}'.format(self.tag)
189192
elif self.checksum:

0 commit comments

Comments
 (0)