10000 Merge branch 'main' into feature/encoding_compliance · spdx/tools-python@e8ae39d · GitHub
[go: up one dir, main page]

Skip to content

Commit e8ae39d

Browse files
Merge branch 'main' into feature/encoding_compliance
2 parents a1584b7 + ed9a135 commit e8ae39d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/spdx_tools/spdx/validation/uri_validators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def validate_url(url: str) -> List[str]:
2828

2929

3030
def validate_download_location(location: str) -> List[str]:
31-
if not re.match(download_location_pattern, location):
32-
return [f"must be a valid download location according to the specification, but is: {location}"]
31+
if not (validate_url(location) == [] or re.match(download_location_pattern, location)):
32+
return [f"must be a valid URL or download location according to the specification, but is: {location}"]
3333

3434
return []
3535

tests/spdx/validation/test_uri_validators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
)
1919
def test_valid_url(input_value):
2020
assert validate_url(input_value) == []
21+
# URLs are also valid download locations:
22+
assert validate_download_location(input_value) == []
2123

2224

2325
# TODO: more negative examples: https://github.com/spdx/tools-python/issues/377
@@ -92,7 +94,7 @@ def test_valid_package_download_location(input_value):
9294
)
9395
def test_invalid_package_download_location(input_value):
9496
assert validate_download_location(input_value) == [
95-
f"must be a valid download location according to the specification, but is: {input_value}"
97+
f"must be a valid URL or download location according to the specification, but is: {input_value}"
9698
]
9799

98100

0 commit comments

Comments
 (0)
0