From cd555c840c14c4de95e41d23c6a9ce5de6105732 Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 4 Sep 2021 19:22:51 +0200 Subject: [PATCH] Added dollar escape $ and a way to force end variables with ^_^ --- backend/app_sdk/app_base.py | 21 ++++++++++++++++++++- backend/app_sdk/build.sh | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index c32b82aa..e82cd68a 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -1594,7 +1594,19 @@ class AppBase: # JSON / yaml etc shouldn't have spaces in their fields anyway. #match = ".*?([$]{1}([a-zA-Z0-9 _-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,})[$/, ]?" #match = ".*?([$]{1}([a-zA-Z0-9 _-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,})" - match = ".*?([$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,})" # Removed space - no longer ok + + match = ".*?([$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,})" # Removed space - no longer ok. Force underscore. + + # Extra replacements for certain scenarios + escaped_dollar = "\\$" + escape_replacement = "\\%\\%\\%\\%\\%" + end_variable = "^_^" + + print("Input value: %s" % parameter["value"]) + try: + parameter["value"] = parameter["value"].replace(escaped_dollar, escape_replacement, -1) + except: + print("Error in initial replacement!") # Regex to find all the things if parameter["variant"] == "STATIC_VALUE": @@ -1725,6 +1737,13 @@ class AppBase: pass #print("POST liquid: %s" % parameter["value"]) + try: + parameter["value"] = parameter["value"].replace(end_variable, "", -1) + parameter["value"] = parameter["value"].replace(escape_replacement, escaped_dollar, -1) + except: + print("Error in datareplacement") + pass + return "", parameter["value"], is_loop def run_validation(sourcevalue, check, destinationvalue): diff --git a/backend/app_sdk/build.sh b/backend/app_sdk/build.sh index 8155e57f..55a612b1 100644 --- a/backend/app_sdk/build.sh +++ b/backend/app_sdk/build.sh @@ -3,7 +3,7 @@ ### DEFAULT NAME=shuffle-app_sdk -VERSION=0.9.12 +VERSION=0.9.14 docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION