interpolate: escape backticks

This commit is contained in:
Deniz Akşimşek 2022-02-19 16:26:43 +03:00 committed by GitHub
parent 3bcaaf408b
commit cf0a1a3a3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,9 @@ function addScript(url) {
function interpolate(str, params) {
try {
return eval(`env => { with (env) { return \`${str}\` } }`)(params)
return eval(
`env => { with (env) { return \`${str.replace(/`/, '\\`'}\` } }`
)(params)
} catch (e) {
return e.message;
}