Skip to content

Commit 5dc8332

Browse files
committed
Do not include version in AffectedPackage base PURL
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 5172be5 commit 5dc8332

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

vulnerabilities/pipes/osv_v2.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,11 @@ def get_affected_purl(affected_pkg, raw_id):
305305
data and a ``raw_id``.
306306
"""
307307
package = affected_pkg.get("package") or {}
308-
purl = package.get("purl")
309-
if purl:
308+
if purl := package.get("purl"):
310309
try:
311-
purl = PackageURL.from_string(purl)
310+
purl_dict = PackageURL.from_string(purl).to_dict()
311+
del purl_dict["version"]
312+
purl = PackageURL(**purl_dict)
312313
except ValueError:
313314
logger.error(
314315
f"Invalid PackageURL: {purl!r} for OSV "

0 commit comments

Comments
 (0)