Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iarna opened this issue Jun 16, 2018 · 0 comments

Comments

@iarna
Copy link

iarna commented Jun 16, 2018

This appears to have been introduced by: #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 iarna changed the title Backslashes may ONLY precede valid escapes, pre the spec. toml-node allows escape sequences not defined in the TOML spec in double quoted strings Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant