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:
66
66
.. _SPDX license expression spec: https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/
67
67
.. _license-expression library: https://github.com/nexB/license-expression
68
68
"""
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:
92
92
'MIT AND Apache-2.0 OR something-unknown'
93
93
'something invalid' ,
94
94
'(c) John Doe' ,
95
+ 'Apache License, Version 2.0'
95
96
)
96
97
def test_negative (self , invalid_expression : str ) -> None :
97
98
actual = spdx .is_compound_expression (invalid_expression )
You can’t perform that action at this time.
0 commit comments