diff --git a/src/packagedcode/nuget.py b/src/packagedcode/nuget.py index d0d7e110f2f..888a3286bce 100644 --- a/src/packagedcode/nuget.py +++ b/src/packagedcode/nuget.py @@ -237,6 +237,10 @@ def parse(cls, location, package_only=False): is_direct = True elif package_type == "Transitive": is_direct = False + elif package_type == "CentralTransitive": + is_direct = False + elif package_type == "Project": + is_direct = True else: raise Exception(f"Unknown package type: {package_type} for package {package_name} in {location}") diff --git a/tests/packagedcode/data/nuget/packages.lock.with_project_and_central_transitive.json b/tests/packagedcode/data/nuget/packages.lock.with_project_and_central_transitive.json new file mode 100644 index 00000000000..ce8c59cddfe --- /dev/null +++ b/tests/packagedcode/data/nuget/packages.lock.with_project_and_central_transitive.json @@ -0,0 +1,30 @@ +{ + "version": 2, + "dependencies": { + "net8.0": { + "Example.Direct": { + "type": "Direct", + "requested": "[1.0.0, )", + "resolved": "1.0.0", + "contentHash": "abc123==" + }, + "Example.Transitive": { + "type": "Transitive", + "resolved": "2.0.0", + "contentHash": "def456==" + }, + "Example.CentralTransitive": { + "type": "CentralTransitive", + "requested": "[3.0.0, )", + "resolved": "3.0.0", + "contentHash": "ghi789==" + }, + "example.project.reference": { + "type": "Project", + "dependencies": { + "Example.Direct": "[1.0.0, )" + } + } + } + } + }