mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(nuget): recognize license types case-insensitively (#12643)
This commit is contained in:
1 parent
939dd19efe
commit
d68f6207cd
4 files changed
+17
-12
No files matched your search
@@ -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
|
||||
|
||||
@@ -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 `<group>`, ungrouped dependencies form a group
|
||||
with `target_framework: null`. Beside groups, in any `<dependencies>` 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 `<group>`, ungrouped dependencies
|
||||
form a group with `target_framework: null`. Beside groups, in any
|
||||
`<dependencies>` 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.
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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(
|
||||
<ext:metadata>
|
||||
<ext:id>Extension</ext:id><id>Demo.Package</id>
|
||||
<ext:version>9.0.0</ext:version><version>1.2.3</version>
|
||||
<ext:license type="expression">ISC</ext:license><license type="expression">MIT</license>
|
||||
<ext:license type="expression">ISC</ext:license><license type="EXPRESSION">MIT</license>
|
||||
<ext:repository type="git" url="https://example.invalid/extension" />
|
||||
<repository type="git" url="https://example.invalid/declared" />
|
||||
<ext:authors>Alice</ext:authors><authors>Second author</authors>
|
||||
|
||||
Reference in new issue
Block a user