diff --git a/src/lib/variables-editor.ts b/src/lib/variables-editor.ts index f07575b..3d8965a 100644 --- a/src/lib/variables-editor.ts +++ b/src/lib/variables-editor.ts @@ -526,7 +526,7 @@ function escapeHtml(s) { // (see DistService.saveTemplateVariablesFile). Backslash/quote-escape for the JS-string // context first, then HTML-escape the result so it can't break out of the attribute either. function escapeJsAttr(s) { - return escapeHtml(String(s).replace(/\\/g, '\\\\').replace(/'/g, "\\'")); + return escapeHtml(String(s).replace(/\\\\/g, '\\\\\\\\').replace(/'/g, "\\\\'")); } function showBanner(type, html) { diff --git a/tests/unit/lib/variables-editor.spec.ts b/tests/unit/lib/variables-editor.spec.ts index f520d83..ffda857 100644 --- a/tests/unit/lib/variables-editor.spec.ts +++ b/tests/unit/lib/variables-editor.spec.ts @@ -341,5 +341,26 @@ describe('registerVariablesEditorRoutes', () => { expect(res.body).not.toContain('id="tab-schema"'); expect(res.body).not.toContain('id="save-btn"'); }); + + // Every `