diff --git a/docs/guides/managed/nuget-nupkg.md b/docs/guides/managed/nuget-nupkg.md index b97b136cf0..c37712a139 100644 --- a/docs/guides/managed/nuget-nupkg.md +++ b/docs/guides/managed/nuget-nupkg.md @@ -38,10 +38,11 @@ metadata namespace. Missing fields are `null`. In the `.nuspec` and OPC relationships, XML end-of-line handling maps CRLF and lone CR to LF. When no `.nuspec` can be selected, `identity` is `null`. -`license` reports the `.nuspec` license element: `type` is `expression` or -`file` when that attribute is present, otherwise `null`, and `value` is the -element text. `repository` reports `type`, `url`, `commit`, and `branch` -attributes when a repository element is present. Absent elements stay `null`. +`license` reports the `.nuspec` license element. `type` is `expression` or +`file` after a case-insensitive match, and `null` for missing or unrecognized +types. `value` is the element text. `repository` reports `type`, `url`, `commit`, +and `branch` attributes when a repository element is present. Absent elements +stay `null`. Transport URL userinfo is excluded, with `url_credentials_redacted` marking that exclusion; a URL whose credential span cannot be located is `null` with that flag set. Other URL spelling and query values are preserved. OPC diff --git a/docs/specs/artifacts/nuget-nupkg/spec.md b/docs/specs/artifacts/nuget-nupkg/spec.md index 136a3ad7cd..b4f987868e 100644 --- a/docs/specs/artifacts/nuget-nupkg/spec.md +++ b/docs/specs/artifacts/nuget-nupkg/spec.md @@ -15,11 +15,13 @@ executing anything in it or contacting a NuGet feed. `http://schemas.microsoft.com/packaging/2010/07/manifest` when that target exists, otherwise from a unique root `.nuspec`. Missing, ambiguous or malformed manifests succeed with the ZIP inventory, `identity: null` and an explicit limitation. -- Report `identity`, `license`, `repository` and `dependency_groups` as spelled - in the `.nuspec`. Without any ``, ungrouped dependencies form a group - with `target_framework: null`. Beside groups, in any `` element, - they are omitted with a limitation that counts them, as NuGet's restore-time - reader ignores them. Version ranges stay text; restore results are unknown. +- Report the `identity`, `license`, `repository` and `dependency_groups` + declared in the `.nuspec`. Normalize the named license types `expression` + and `file` case-insensitively. Without any ``, ungrouped dependencies + form a group with `target_framework: null`. Beside groups, in any + `` element, they are omitted with a limitation that counts + them, as NuGet's restore-time reader ignores them. Version ranges stay text; + restore results are unknown. - List file ZIP members with sizes, an `encrypted` flag and a path-derived NuGet folder `role`. `[Content_Types].xml`, `.rels` parts, and members under `_rels/` or `package/` are OPC packaging parts. Omit directory markers. diff --git a/src/nuget/NugetNupkgParser.ts b/src/nuget/NugetNupkgParser.ts index 66136a8a7d..7a02430514 100644 --- a/src/nuget/NugetNupkgParser.ts +++ b/src/nuget/NugetNupkgParser.ts @@ -424,7 +424,9 @@ const parseNuspecDocument = ( return element === undefined ? null : elementText(element); }; const licenseElement = firstNamed(metadata, "license", metadataNamespace); - const licenseType = licenseElement ? attribute(licenseElement, "type") : null; + const licenseType = licenseElement + ? attribute(licenseElement, "type")?.toLowerCase() + : undefined; const repositoryElement = firstNamed( metadata, "repository", diff --git a/tests/acceptance/nugetNupkgCli.test.ts b/tests/acceptance/nugetNupkgCli.test.ts index 37ffc3fdd3..89f96a8f82 100644 --- a/tests/acceptance/nugetNupkgCli.test.ts +++ b/tests/acceptance/nugetNupkgCli.test.ts @@ -129,7 +129,7 @@ cliTest( ); cliTest( - "matches NuGet's field namespace rules through CLI and MCP", + "matches NuGet's field namespaces and license type through CLI and MCP", async ({ cli }) => { const root = await createTestTempDirectory("rea-nupkg-cli-mcp-"); const path = join(root, "Demo.Package.nupkg"); @@ -140,7 +140,7 @@ cliTest( ExtensionDemo.Package 9.0.01.2.3 - ISCMIT + ISCMIT AliceSecond author