Skip to content

Commit 4ec8376

Browse files
authored
Bugfix/get rid of double quotes when replacing variable value (#2577)
get rid of double quotes when replacing variable value
1 parent 5ba9493 commit 4ec8376

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/server/src/utils/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,13 @@ export const getVariableValue = (
782782
const variableValue = variableDict[path]
783783
// Replace all occurrence
784784
if (typeof variableValue === 'object') {
785-
returnVal = returnVal.split(path).join(JSON.stringify(JSON.stringify(variableValue)))
785+
const stringifiedValue = JSON.stringify(JSON.stringify(variableValue))
786+
if (stringifiedValue.startsWith('"') && stringifiedValue.endsWith('"')) {
787+
// get rid of the double quotes
788+
returnVal = returnVal.split(path).join(stringifiedValue.substring(1, stringifiedValue.length - 1))
789+
} else {
790+
returnVal = returnVal.split(path).join(JSON.stringify(variableValue).replace(/"/g, '\\"'))
791+
}
786792
} else {
787793
returnVal = returnVal.split(path).join(variableValue)
788794
}

0 commit comments

Comments
 (0)