diff --git a/src/utils/config/yaml.js b/src/utils/config/yaml.js index f8125ab11..6266689bd 100644 --- a/src/utils/config/yaml.js +++ b/src/utils/config/yaml.js @@ -1,7 +1,7 @@ import * as yaml from "js-yaml"; const EMPTY_DOCUMENT_ERROR = "expected a document, but the input is empty"; -const DEFAULT_SCHEMA = yaml.CORE_SCHEMA.withTags(yaml.timestampTag, yaml.mergeTag); +const DEFAULT_SCHEMA = yaml.CORE_SCHEMA.withTags(yaml.timestampTag, yaml.mergeTag, yaml.legacyMapTag); export function loadYaml(input, options) { try { diff --git a/src/utils/config/yaml.test.js b/src/utils/config/yaml.test.js index 4af6b7b3a..aa437a62e 100644 --- a/src/utils/config/yaml.test.js +++ b/src/utils/config/yaml.test.js @@ -25,6 +25,16 @@ describe("utils/config/yaml", () => { }); }); + it("preserves v4 handling of non-string keys", () => { + // an unsubstituted {{HOMEPAGE_VAR_*}} parses as a flow mapping key + expect(loadYaml("- Plex:\n widget:\n key: {{HOMEPAGE_VAR_PLEX_KEY}}\n")).toEqual([ + { Plex: { widget: { key: { "[object Object]": null } } } }, + ]); + expect(loadYaml("- Backups:\n - 2024-01-01:\n href: http://x\n")).toEqual([ + { Backups: [{ [String(new Date("2024-01-01T00:00:00.000Z"))]: { href: "http://x" } }] }, + ]); + }); + it("still rejects invalid YAML", () => { expect(() => loadYaml("value: [\n")).toThrow(); });