[pmg-devel] [PATCH pmg-gui] gui: properly encode rule names in overview

Leo Nunner l.nunner at proxmox.com
Tue Mar 28 14:08:21 CEST 2023


Rule names were not HTML-encoded in the rule overview. While some
encoding did happen, it was only on the first load for the info panel on
the right hand side, which was overriden as soon as the edit window was
opened/closed again.

The variable binding now gets HTML-encoded automatically, and the renderer
for rule names has been set to Ext.htmlEncode.

Signed-off-by: Leo Nunner <l.nunner at proxmox.com>
---
 js/RuleConfiguration.js | 1 +
 js/RuleInfo.js          | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/js/RuleConfiguration.js b/js/RuleConfiguration.js
index 859a3d9..1209b1d 100644
--- a/js/RuleConfiguration.js
+++ b/js/RuleConfiguration.js
@@ -216,6 +216,7 @@ Ext.define('PMG.RulesConfiguration', {
 		    text: 'Name',
 		    dataIndex: 'name',
 		    flex: 1,
+		    renderer: Ext.htmlEncode,
 		},
 		{
 		    text: 'Priority',
diff --git a/js/RuleInfo.js b/js/RuleInfo.js
index b7802fa..8f39695 100644
--- a/js/RuleInfo.js
+++ b/js/RuleInfo.js
@@ -86,7 +86,6 @@ Ext.define('PMG.RuleInfo', {
 		viewmodel.set('selectedRule', null);
 		viewmodel.get('objects').setData([]);
 	    } else {
-		ruledata.name = Ext.String.htmlEncode(ruledata.name);
 		viewmodel.set('selectedRule', ruledata);
 
 		var data = [];
@@ -234,7 +233,7 @@ Ext.define('PMG.RuleInfo', {
 	    },
 	    bind: {
 		data: {
-		    name: '{selectedRule.name}',
+		    name: '{selectedRule.name:htmlEncode}',
 		    priority: '{selectedRule.priority}',
 		    active: '{selectedRule.active}',
 		    direction: '{selectedRule.direction}',
-- 
2.30.2





More information about the pmg-devel mailing list