Fix JSON escaping (better) (#2498)

Fix JSON escaping
This commit is contained in:
YISH
2024-05-30 19:58:20 +08:00
committed by GitHub
parent eb738a1552
commit d50563765e
+1 -1
View File
@@ -780,7 +780,7 @@ export const getVariableValue = (
const variableValue = variableDict[path] const variableValue = variableDict[path]
// Replace all occurrence // Replace all occurrence
if (typeof variableValue === 'object') { if (typeof variableValue === 'object') {
returnVal = returnVal.split(path).join(JSON.stringify(variableValue).replaceAll('"', '\\"').replaceAll('\\n', '\\\\n')) returnVal = returnVal.split(path).join(JSON.stringify(JSON.stringify(variableValue)))
} else { } else {
returnVal = returnVal.split(path).join(variableValue) returnVal = returnVal.split(path).join(variableValue)
} }