Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packagedb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,10 @@ def get_resolved_purls(packages):
for items in packages or []:
purl = items.get('purl')
vers = items.get('vers')


if not purl:
continue

try:
parsed_purl = PackageURL.from_string(purl)
except ValueError:
Expand All @@ -706,6 +709,10 @@ def get_resolved_purls(packages):
unique_resolved_purls.add(purl)
continue

if not vers:
unsupported_purls.add(purl)
continue

if resolved:= resolve_versions(parsed_purl, vers):
unique_resolved_purls.update(resolved)
else:
Expand All @@ -720,6 +727,9 @@ def resolve_versions(parsed_purl, vers):
Take version-less purl along with vers range and return
list of all the purls satisfying the vers range.
"""
if not parsed_purl or not vers:
return

try:
version_range = VersionRange.from_string(vers)
except ValueError:
Expand Down