Added gettext and escape around Macro name and label. Fixes #5894

pull/35/head
Murtuza Zabuawala 2020-10-08 11:23:45 +05:30 committed by Akshay Joshi
parent f27527a614
commit 483eeeca39
2 changed files with 6 additions and 5 deletions

View File

@ -10,6 +10,7 @@
import gettext from 'sources/gettext';
import url_for from 'sources/url_for';
import $ from 'jquery';
import _ from 'underscore';
import Alertify from 'pgadmin.alertifyjs';
import pgAdmin from 'sources/pgadmin';
import Backform from 'pgadmin.backform';
@ -269,16 +270,16 @@ let MacroDialog = {
var str = `
<li>
<a class="dropdown-item" id="btn-manage-macros" href="#" tabindex="0">
<span> Manage Macros... </span>
<span> ${gettext('Manage Macros...')} </span>
</a>
</li>
<li class="dropdown-divider"></li>`;
_.each(macros, function(m) {
if (m.name) {
str += `<li>
<a class="dropdown-item btn-macro" data-macro-id="`+ m.id +`" href="#" tabindex="0">
<span>` + m.name + `</span>
<span> (` + m.key_label + `) </span>
<a class="dropdown-item btn-macro" data-macro-id="${m.id}" href="#" tabindex="0">
<span> ${_.escape(m.name)} </span>
<span> (${m.key_label}) </span>
</a>
</li>`;
}

View File

@ -395,7 +395,7 @@
{% for i in macros %}
<li>
<a class="dropdown-item btn-macro" data-macro-id="{{ i.id }}" href="#" tabindex="0">
<span> {{ _(i.name) }} </span>
<span> {{ _(i.name)|e }} </span>
<span> ({{ i.key_label }}) </span>
</a>
</li>