diff --git a/src/domain/propertyListXml.test.ts b/src/domain/propertyListXml.test.ts index 4de709e4be..47efef1c23 100644 --- a/src/domain/propertyListXml.test.ts +++ b/src/domain/propertyListXml.test.ts @@ -38,6 +38,17 @@ it("keeps document-level processing instructions outside plist members", () => { expect(parsed.numberLiterals.incomplete).toBe(false); }); +it("rejects a dictionary key without a value and preserves an explicit empty string", () => { + expect(() => + parseXmlPropertyList("missing"), + ).toThrow("Missing value for key while parsing "); + expect( + parseXmlPropertyList( + "empty", + ).value, + ).toEqual({ empty: "" }); +}); + it.each([ ["CDATA", "after]]>"], ["escaped text", "before<?rea content?>after"], diff --git a/src/domain/propertyListXml.ts b/src/domain/propertyListXml.ts index 757f3602c5..f25d63d524 100644 --- a/src/domain/propertyListXml.ts +++ b/src/domain/propertyListXml.ts @@ -85,7 +85,8 @@ export const decodeXmlPropertyList = (text: string) => { key = undefined; } } - if (key !== undefined) entries.push([key, ""]); + if (key !== undefined) + throw new TypeError("Missing value for key while parsing "); // Define own properties safely, including __proto__; the caller owns omission accounting. return Object.fromEntries(entries); }