File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ def is_compound_expression(value: str) -> bool:
6666 .. _SPDX license expression spec: https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/
6767 .. _license-expression library: https://github.com/nexB/license-expression
6868 """
69- return 0 == len (
70- __SPDX_EXPRESSION_LICENSING .validate (value ).errors
71- )
69+ try :
70+ res = __SPDX_EXPRESSION_LICENSING .validate (value )
71+ except Exception :
72+ # the throw happens when internals crash due to unexpected input characters.
73+ return False
74+ return 0 == len (res .errors )
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ def test_positive(self, valid_expression: str) -> None:
9292 'MIT AND Apache-2.0 OR something-unknown'
9393 'something invalid' ,
9494 '(c) John Doe' ,
95+ 'Apache License, Version 2.0'
9596 )
9697 def test_negative (self , invalid_expression : str ) -> None :
9798 actual = spdx .is_compound_expression (invalid_expression )
You can’t perform that action at this time.
0 commit comments