Skip to content

Commit

Permalink
Handle invalid constraints sequence exception
Browse files Browse the repository at this point in the history
- issue aboutcode-org/univers#118

Signed-off-by: Keshav Priyadarshi <[email protected]>
  • Loading branch information
keshav-space committed Sep 6, 2023
1 parent 2e824e1 commit 42a8892
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions packagedb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,18 +749,23 @@ def resolve_versions(parsed_purl, vers):

all_versions = get_all_versions(parsed_purl) or []

return [
str(
PackageURL(
type=parsed_purl.type,
namespace=parsed_purl.namespace,
name=parsed_purl.name,
version=version.string,
)
)
for version in all_versions
if version in version_range
]
result = []

for version in all_versions:
try:
if version in version_range:
package_url = PackageURL(
type=parsed_purl.type,
namespace=parsed_purl.namespace,
name=parsed_purl.name,
version=version.string,
)
result.append(str(package_url))
except Exception:
# Skip the ``Invalid constraints sequence`` Exception
pass

return result

def get_all_versions(purl: PackageURL):
"""
Expand Down

0 comments on commit 42a8892

Please sign in to comment.