8000 fix(validation): also allow URLs in download locations · spdx/tools-python@275d245 · GitHub
[go: up one dir, main page]

Skip to content

Commit 275d245

Browse files
committed
fix(validation): also allow URLs in download locations
fix #761 fix #762 Signed-off-by: Maximilian Huber <maximilian.huber@tngtech.com>
1 parent 3d3100a commit 275d245

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
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: 2 additions & 0 deletions
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

0 commit comments

Comments
 (0)
0