Fixed an issue with ast literal eval parsing 7e7 as a mathematical operation instead of pure string
This commit is contained in:
@@ -3089,11 +3089,12 @@ class AppBase:
|
|||||||
for key, value in params.items():
|
for key, value in params.items():
|
||||||
try:
|
try:
|
||||||
if isinstance(value, str) and ((value.startswith("{") and value.endswith("}")) or (value.startswith("[") and value.endswith("]"))):
|
if isinstance(value, str) and ((value.startswith("{") and value.endswith("}")) or (value.startswith("[") and value.endswith("]"))):
|
||||||
params[key] = ast.literal_eval(value)
|
params[key] = json.loads(value)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
try:
|
try:
|
||||||
params[key] = json.loads(value)
|
if isinstance(value, str) and ((value.startswith("{") and value.endswith("}")) or (value.startswith("[") and value.endswith("]"))):
|
||||||
except json.decoder.JSONDecodeError as e:
|
params[key] = ast.literal_eval(value)
|
||||||
|
except Exception as e:
|
||||||
self.logger.info(f"[DEBUG] Failed parsing value with ast and json.loads - noncritical. Trying next: {e}")
|
self.logger.info(f"[DEBUG] Failed parsing value with ast and json.loads - noncritical. Trying next: {e}")
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user