2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: Properly encode string literals in hbs compiler

This commit is contained in:
Robin Ward 2017-10-04 12:48:14 -04:00
parent ddbd1d5ab8
commit 051b49efdb
2 changed files with 7 additions and 2 deletions

View file

@ -11,7 +11,12 @@ function sexp(value) {
let result = [];
value.hash.pairs.forEach(p => {
result.push(`"${p.key}": ${p.value.original}`);
let pValue = p.value.original;
if (p.value.type === "StringLiteral") {
pValue = JSON.stringify(pValue);
}
result.push(`"${p.key}": ${pValue}`);
});
return `{ ${result.join(", ")} }`;