Commit 2c7837c
committed
Fail if metadata.json contains invalid escape sequence
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>
```1 parent 9cbe5b5 commit 2c7837c
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
| |||
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| 94 | + | |
| 95 | + | |
86 | 96 | | |
87 | 97 | | |
88 | 98 | | |
| |||
0 commit comments