From 366d14a3e8dbb64667e2fdd52391ea1df6eaac2b Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 27 Jun 2020 07:40:49 +0200 Subject: [PATCH] Fixed JSON parsing within string --- backend/app_sdk/app_base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index f607e452..94f31d09 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -409,6 +409,9 @@ class AppBase: print("INDEXVAL: ", indexvalue) return indexvalue + except TypeError as e: + print("Inner TypeError: %s" % e) + return basejson # Example format: ${[]}$ parseditem = "${%s%s}$" % (parsersplit[cnt+1], json.dumps(returnlist)) @@ -436,7 +439,10 @@ class AppBase: def parse_params(action, fullexecution, parameter): # Skip if it starts with $? jsonparsevalue = "$." - match = ".*([$]{1}([a-zA-Z0-9# _-]+\.?){1,})" + + # Matches with space in the first part, but not in subsequent parts. + # JSON / yaml etc shouldn't have spaces in their fields anyway. + match = ".*?([$]{1}([a-zA-Z0-9 _-]+\.?){1}([a-zA-Z0-9_-]+\.?){0,})" # Regex to find all the things if parameter["variant"] == "STATIC_VALUE":