diff --git a/lib/ini.js b/lib/ini.js index 0e8623e..beb390d 100644 --- a/lib/ini.js +++ b/lib/ini.js @@ -140,7 +140,9 @@ const decode = (str, opt = {}) => { duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1 isArray = duplicates[keyRaw] > 1 } - const key = isArray ? keyRaw.slice(0, -2) : keyRaw + const key = isArray && keyRaw.endsWith('[]') + ? keyRaw.slice(0, -2) : keyRaw + if (key === '__proto__') { continue } diff --git a/tap-snapshots/test/duplicate-properties.js.test.cjs b/tap-snapshots/test/duplicate-properties.js.test.cjs index 4a88d10..7feb707 100644 --- a/tap-snapshots/test/duplicate-properties.js.test.cjs +++ b/tap-snapshots/test/duplicate-properties.js.test.cjs @@ -11,12 +11,12 @@ Null Object { "three", ], "ar[]": "one", - "b": Array [ + "brr": Array [ + "1", "2", "3", "3", ], - "brr": "1", "str": "3", "zr": "123", "zr[]": "deedee",