fix: map "nuget" purl type to DotnetPkg in TypeByName (#4848)

Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
This commit is contained in:
ChrisJr404 2026-05-04 08:51:19 -04:00 committed by GitHub
parent 8cb78ce40c
commit b5f0877967
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -220,7 +220,7 @@ func TypeByName(name string) Type {
return CondaPkg return CondaPkg
case packageurl.TypePub: case packageurl.TypePub:
return DartPubPkg return DartPubPkg
case "dotnet": // here to support legacy use cases case "dotnet", packageurl.TypeNuget: // "dotnet" is here to support legacy use cases; "nuget" is the canonical purl type
return DotnetPkg return DotnetPkg
case packageurl.TypeCocoapods: case packageurl.TypeCocoapods:
return CocoapodsPkg return CocoapodsPkg

View File

@ -58,6 +58,11 @@ func TestTypeFromPURL(t *testing.T) {
purl: "pkg:dotnet/Microsoft.CodeAnalysis.Razor@2.2.0", purl: "pkg:dotnet/Microsoft.CodeAnalysis.Razor@2.2.0",
expected: DotnetPkg, expected: DotnetPkg,
}, },
{
name: "nuget purl maps to dotnet",
purl: "pkg:nuget/Minio@7.0.0",
expected: DotnetPkg,
},
{ {
purl: "pkg:composer/laravel/laravel@5.5.0", purl: "pkg:composer/laravel/laravel@5.5.0",
expected: PhpComposerPkg, expected: PhpComposerPkg,