toml-node icon indicating copy to clipboard operation
toml-node copied to clipboard

toml-node allows escape sequences not defined in the TOML spec in double quoted strings

Open iarna opened this issue 6 years ago • 0 comments

This appears to have been introduced by: https://github.com/BinaryMuse/toml-node/issues/21

To sum up the problem:

Given the following TOML:

["the\ key"]

one = "one"
two = 2
three = false

This library produces:

{"the\\ key":{"one":"one","two":2,"three":false}}

In contrast, it should produce an error, per the spec:

All other escape sequences not listed above are reserved and, if used, TOML should produce an error.

Restoring this to an error would make this library's behavior consistent with toml-j0.4 and @iarna/toml.

Valid TOML with a slash in the key name would be either of these:

["the\\ key"]

one = "one"
two = 2
three = false

or Edit: The one below seems to be an extension that's on the 1.0 track, but not in 0.4. It's currently supported, however.

['the\ key']

one = "one"
two = 2
three = false

iarna avatar Jun 16 '18 06:06 iarna