[utils] js_to_json: Make function less fatal (#12715)
Authored by: seproDev
This commit is contained in:
parent
b7fbb5a0a1
commit
9491b44032
2 changed files with 3 additions and 1 deletions
|
|
@ -2767,7 +2767,8 @@ def js_to_json(code, vars={}, *, strict=False):
|
|||
def template_substitute(match):
|
||||
evaluated = js_to_json(match.group(1), vars, strict=strict)
|
||||
if evaluated[0] == '"':
|
||||
return json.loads(evaluated)
|
||||
with contextlib.suppress(json.JSONDecodeError):
|
||||
return json.loads(evaluated)
|
||||
return evaluated
|
||||
|
||||
def fix_kv(m):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue