mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 13:12:26 +00:00
fix(artifacts): apply XML end-of-line handling to nuspec and POM text (#11846)
The .nuspec, its OPC relationships and the Maven POM now parse with lineEndings normalize, as XML 1.0 section 2.11 and the NuGet and Maven readers do. Text from CRLF files no longer keeps carriage returns.
This commit is contained in:
6 files changed
+42
-5
No files matched your search
@@ -415,6 +415,19 @@ it("removes credentials from POM property values", () => {
|
||||
expect(JSON.stringify(report)).not.toContain("password");
|
||||
});
|
||||
|
||||
it("applies XML end-of-line handling to POM text", () => {
|
||||
const report = parse(
|
||||
"<project>\r\n <modelVersion>4.0.0</modelVersion>\r\n <artifactId>demo</artifactId>\r\n <properties>\r\n <banner>first\r\nsecond\rthird</banner>\r\n </properties>\r\n</project>\r\n",
|
||||
);
|
||||
expect(report.properties).toEqual([
|
||||
{
|
||||
name: "banner",
|
||||
value: "first\nsecond\nthird",
|
||||
value_credentials_redacted: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("lists properties in packaging, scope, type and classifier", () => {
|
||||
const report = parse(`<project>
|
||||
<groupId>com.example</groupId>
|
||||
|
||||
@@ -272,9 +272,11 @@ const parsePom = (
|
||||
MAVEN_GRADLE_METADATA_XML_NODES,
|
||||
nodes,
|
||||
);
|
||||
// Maven's XML reader applies XML 1.0 end-of-line handling, so a POM saved
|
||||
// with CRLF yields the same property and coordinate text as one with LF.
|
||||
const parsed = parseXmlDocument(xml, {
|
||||
doctype: "reject",
|
||||
lineEndings: "preserve",
|
||||
lineEndings: "normalize",
|
||||
});
|
||||
if (!parsed.ok)
|
||||
throw parsed.error.kind === "unsupported"
|
||||
|
||||
Reference in new issue
Block a user