Skip to content

Commit 39c28e3

Browse files
committed
Use PURL type to get version class
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent dcd5d70 commit 39c28e3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

vulnerabilities/importer.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,13 @@ def from_dict(cls, affected_pkg: dict):
268268
return
269269

270270
fixed_version = affected_pkg["fixed_version"]
271-
if fixed_version and affected_version_range:
272-
# TODO: revisit after https://github.com/nexB/univers/issues/10
273-
fixed_version = affected_version_range.version_class(fixed_version)
271+
if fixed_version:
272+
if affected_version_range:
273+
# TODO: revisit after https://github.com/nexB/univers/issues/10
274+
fixed_version = affected_version_range.version_class(fixed_version)
275+
elif package.type in RANGE_CLASS_BY_SCHEMES:
276+
vrc = RANGE_CLASS_BY_SCHEMES[package.type]
277+
fixed_version = vrc.version_class(fixed_version)
274278

275279
if not fixed_version and not affected_version_range:
276280
logger.error(

0 commit comments

Comments
 (0)