Skip to content

Commit 015382f

Browse files
committed
feat(spdx-utils): Validate also the characters in an SPDX ID
Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent e166ebf commit 015382f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

utils/spdx/src/main/kotlin/model/SpdxPackage.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ data class SpdxPackage(
192192
"The SPDX ID '$spdxId' has to start with '${SpdxConstants.REF_PREFIX}'."
193193
}
194194

195+
require(spdxId.all { it.isLetterOrDigit() || it == '.' || it == '-' }) {
196+
"The SPDX ID '$spdxId' is only allowed to contain letters, numbers, '.', and '-'."
197+
}
198+
195199
require(copyrightText.isNotBlank()) { "The copyright text must not be blank." }
196200

197201
require(downloadLocation.isNotBlank()) { "The download location must not be blank." }

0 commit comments

Comments
 (0)