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

View File

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