Skip to content

Commit ea97fb6

Browse files
committed
Remove slashes from SPDX package refs
SPDX does not allow slashes in SPDXRefs. Golang pacakges, however, tend to have slashes in their package names which is what Tern uses to create the SPDXRefs. This commit replaces slashes in refs with dashes. Resolves #1220 Signed-off-by: Rose Judge <[email protected]>
1 parent 6be6976 commit ea97fb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tern/formats/spdx/spdx_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ def get_package_spdxref(package_obj):
170170
ver=src_ver)
171171
# replace all the strings that SPDX doesn't like
172172
# allowed characters are: letters, numbers, "." and "-"
173-
clean_pkg_ref = re.sub(r'[:+~_]', r'-', pkg_ref)
173+
clean_pkg_ref = re.sub(r'[:+~_/]', r'-', pkg_ref)
174174
if src_ref:
175-
clean_src_ref = re.sub(r'[:+~]', r'-', src_ref)
175+
clean_src_ref = re.sub(r'[:+~/]', r'-', src_ref)
176176
return 'SPDXRef-{}'.format(clean_pkg_ref), 'SPDXRef-{}'.format(clean_src_ref)
177177
return 'SPDXRef-{}'.format(clean_pkg_ref), ''
178178

0 commit comments

Comments
 (0)