Skip to content

Commit

Permalink
fix(validation): also allow URLs in download locations
Browse files Browse the repository at this point in the history
fix #761
fix #762

Signed-off-by: Maximilian Huber <maximilian.huber@tngtech.com>
  • Loading branch information
maxhbr committed Sep 18, 2023
1 parent 3d3100a commit 275d245
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/spdx_tools/spdx/validation/uri_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def validate_url(url: str) -> List[str]:


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

return []

Expand Down
2 changes: 2 additions & 0 deletions tests/spdx/validation/test_uri_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
)
def test_valid_url(input_value):
assert validate_url(input_value) == []
# URLs are also valid download locations:
assert validate_download_location(input_value) == []


# TODO: more negative examples: https://github.com/spdx/tools-python/issues/377
Expand Down

0 comments on commit 275d245

Please sign in to comment.