Minor fix to make JSON only return json if it's actually json

This commit is contained in:
Frikky
2024-03-05 15:30:59 +01:00
parent 0333c0ab6a
commit 1da44d12ec
2 changed files with 18 additions and 0 deletions
+9
View File
@@ -585,6 +585,15 @@ class AppBase:
except:
pass
# Dont return json properly unless actually json
if inputtype == "json":
try:
json.loads(newoutput)
return newoutput
except:
# Returns original if json fixing didn't work
return liquiddata
return newoutput
# FIXME: Add more info like logs in here.
+9
View File
@@ -135,6 +135,15 @@ def patternfix_string(liquiddata, patterns, regex_patterns, inputtype="liquid"):
except:
pass
# Dont return json properly unless actually json
if inputtype == "json":
try:
json.loads(newoutput)
return newoutput
except:
# Returns original if json fixing didn't work
return liquiddata
return newoutput
print("Start:\n%s" % input_data)