-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fail on escape sequences in metadata.json #152
Fail on escape sequences in metadata.json #152
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered if this really was invalid, but it looks like Ruby's JSON parser just silently ignores it while Python raises a hard JSONDecodeError
so 👍 for enforcing it as an error. https://jsonlint.com/ also loudly complains about "\("
.
|
b0eb7bf
to
2c7837c
Compare
This is an enhancement of voxpupuli#120 We now use a regex to identify invalid escape sequences. `JSON.parse()` has no built-in way to detect this. Even in strict mode it ignores it: ``` irb(main):002> require 'json' => true irb(main):003> JSON.parser = JSON::Ext::Parser => JSON::Ext::Parser irb(main):004> JSON.parse('{"summary": "A description with an invalid \( escape sequence"}') => {"summary"=>"A description with an invalid ( escape sequence"} irb(main):005> JSON.parse("{\"summary\": \"A description with an invalid \( escape sequence\"}") => {"summary"=>"A description with an invalid ( escape sequence"} irb(main):006> ```
2c7837c
to
f0b04de
Compare
This is an enhancement of #120
We now use a regex to identify invalid escape sequences.
JSON.parse()
has no built-in way to detect this. Even in strict mode it ignores it: