Escape newline chars in conditionalPanel expr. Fixes #1818

This commit is contained in:
Winston Chang
2017-08-18 17:18:38 -05:00
parent fc32c2c944
commit 1f864a846f
2 changed files with 7 additions and 1 deletions

View File

@@ -161,7 +161,11 @@ function pixelRatio() {
// "with" on the argument value, and return the result.
function scopeExprToFunc(expr) {
/*jshint evil: true */
var expr_escaped = expr.replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');
var expr_escaped = expr
.replace(/[\\"']/g, '\\$&')
.replace(/\u0000/g, '\\0')
.replace(/\n/g, '\\n');
try {
var func = new Function(
`with (this) {