File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -325,7 +325,6 @@ export function getCveInfoByAlertsMap(
325325 alertsMap : AlertsByPkgId ,
326326 options ?: GetCveInfoByPackageOptions | undefined
327327) : CveInfoByPkgId | null {
328- debugLog ( 'getCveInfoByAlertsMap' )
329328 const exclude = {
330329 upgradable : true ,
331330 ...( { __proto__ : null , ...options } as GetCveInfoByPackageOptions ) . exclude
@@ -352,13 +351,22 @@ export function getCveInfoByAlertsMap(
352351 }
353352 const { firstPatchedVersionIdentifier, vulnerableVersionRange } =
354353 alert . props
355- debugLog ( { firstPatchedVersionIdentifier, vulnerableVersionRange } )
356- infos . push ( {
357- firstPatchedVersionIdentifier,
358- vulnerableVersionRange : new semver . Range (
354+ try {
355+ infos . push ( {
356+ firstPatchedVersionIdentifier,
357+ vulnerableVersionRange : new semver . Range (
358+ // Replace ', ' in a range like '>= 1.0.0, < 1.8.2' with ' ' so that
359+ // semver.Range will parse it without erroring.
360+ vulnerableVersionRange . replace ( / , + / g, ' ' )
361+ ) . format ( )
362+ } )
363+ } catch ( e ) {
364+ debugLog ( 'getCveInfoByAlertsMap' , {
365+ firstPatchedVersionIdentifier,
359366 vulnerableVersionRange
360- ) . format ( )
361- } )
367+ } )
368+ debugLog ( e )
369+ }
362370 }
363371 }
364372 return infoByPkg
You can’t perform that action at this time.
0 commit comments