diff options
author | Kevin O'Connor <kevin.oconnor7@gmail.com> | 2020-10-17 13:10:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-18 00:10:41 +0700 |
commit | 4eda10499e8db831167062b0e0dbc7d10d34c1f9 (patch) | |
tree | c0afe01daf906bd9b7f0568eb9cce49e24f15d45 /test/test_age_restriction.py | |
parent | 605535776a8d5beba78b4d1b057d5206ddd969eb (diff) |
[utils] Don't attempt to coerce JS strings to numbers in js_to_json (#26851)
The current logic in `js_to_json` tries to rewrite octal/hex numbers to
decimal. However, when the logic actually happens the `"` or `'` have
already been trimmed off. This causes what were originally strings, that
happen to look like octal/hex numbers, to get rewritten to decimal and
returned as a number rather than a string.
In practive something like:
```js
{
"0x40": "foo",
"040": "bar",
}
```
would get rewritten as:
```json
{
64: "foo",
32: "bar
}
```
This is problematic since this isn't valid JSON as you cannot have
non-string keys.
Diffstat (limited to 'test/test_age_restriction.py')
0 files changed, 0 insertions, 0 deletions