[pve-devel] [PATCH manager 2/2] ui: add some missing `htmlEncode`s
Friedrich Weber
f.weber at proxmox.com
Tue Jul 25 13:52:46 CEST 2023
Signed-off-by: Friedrich Weber <f.weber at proxmox.com>
---
www/manager6/Utils.js | 9 ++++++---
www/manager6/dc/BackupJobDetail.js | 1 +
www/manager6/dc/PCIMapView.js | 2 +-
www/manager6/dc/USBMapView.js | 2 +-
www/manager6/form/PCIMapSelector.js | 1 +
www/manager6/form/USBMapSelector.js | 1 +
www/manager6/qemu/CloudInit.js | 4 ++--
7 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index a150e848..4e094213 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1003,15 +1003,18 @@ Ext.define('PVE.Utils', {
},
render_storage_content: function(value, metaData, record) {
- var data = record.data;
+ let data = record.data;
+ let result;
if (Ext.isNumber(data.channel) &&
Ext.isNumber(data.id) &&
Ext.isNumber(data.lun)) {
- return "CH " +
+ result = "CH " +
Ext.String.leftPad(data.channel, 2, '0') +
" ID " + data.id + " LUN " + data.lun;
+ } else {
+ result = data.volid.replace(/^.*?:(.*?\/)?/, '');
}
- return data.volid.replace(/^.*?:(.*?\/)?/, '');
+ return Ext.String.htmlEncode(result);
},
render_serverity: function(value) {
diff --git a/www/manager6/dc/BackupJobDetail.js b/www/manager6/dc/BackupJobDetail.js
index c4683a47..880784a2 100644
--- a/www/manager6/dc/BackupJobDetail.js
+++ b/www/manager6/dc/BackupJobDetail.js
@@ -249,6 +249,7 @@ Ext.define('PVE.dc.BackupInfo', {
xtype: 'displayfield',
name: 'comment',
fieldLabel: gettext('Comment'),
+ renderer: Ext.String.htmlEncode,
},
{
xtype: 'fieldset',
diff --git a/www/manager6/dc/PCIMapView.js b/www/manager6/dc/PCIMapView.js
index 859ef58f..80fe3c0f 100644
--- a/www/manager6/dc/PCIMapView.js
+++ b/www/manager6/dc/PCIMapView.js
@@ -98,7 +98,7 @@ Ext.define('PVE.dc.PCIMapView', {
header: gettext('Comment'),
dataIndex: 'description',
renderer: function(value, _meta, record) {
- return value ?? record.data.comment;
+ return Ext.String.htmlEncode(value ?? record.data.comment);
},
flex: 1,
},
diff --git a/www/manager6/dc/USBMapView.js b/www/manager6/dc/USBMapView.js
index 953e2425..96edc587 100644
--- a/www/manager6/dc/USBMapView.js
+++ b/www/manager6/dc/USBMapView.js
@@ -90,7 +90,7 @@ Ext.define('PVE.dc.USBMapView', {
header: gettext('Comment'),
dataIndex: 'description',
renderer: function(value, _meta, record) {
- return value ?? record.data.comment;
+ return Ext.String.htmlEncode(value ?? record.data.comment);
},
flex: 1,
},
diff --git a/www/manager6/form/PCIMapSelector.js b/www/manager6/form/PCIMapSelector.js
index 1bc73ec0..49629bc2 100644
--- a/www/manager6/form/PCIMapSelector.js
+++ b/www/manager6/form/PCIMapSelector.js
@@ -40,6 +40,7 @@ Ext.define('PVE.form.PCIMapSelector', {
header: gettext('Description'),
dataIndex: 'description',
flex: 1,
+ renderer: Ext.String.htmlEncode,
},
{
header: gettext('Status'),
diff --git a/www/manager6/form/USBMapSelector.js b/www/manager6/form/USBMapSelector.js
index 6a33754a..2e55c100 100644
--- a/www/manager6/form/USBMapSelector.js
+++ b/www/manager6/form/USBMapSelector.js
@@ -64,6 +64,7 @@ Ext.define('PVE.form.USBMapSelector', {
header: gettext('Comment'),
dataIndex: 'description',
flex: 1,
+ renderer: Ext.String.htmlEncode,
},
],
},
diff --git a/www/manager6/qemu/CloudInit.js b/www/manager6/qemu/CloudInit.js
index 03d06d9c..49519726 100644
--- a/www/manager6/qemu/CloudInit.js
+++ b/www/manager6/qemu/CloudInit.js
@@ -214,7 +214,7 @@ Ext.define('PVE.qemu.CloudInit', {
],
} : undefined,
renderer: function(value) {
- return value || Proxmox.Utils.defaultText;
+ return Ext.String.htmlEncode(value || Proxmox.Utils.defaultText);
},
},
cipassword: {
@@ -236,7 +236,7 @@ Ext.define('PVE.qemu.CloudInit', {
],
} : undefined,
renderer: function(value) {
- return value || Proxmox.Utils.noneText;
+ return Ext.String.htmlEncode(value || Proxmox.Utils.noneText);
},
},
searchdomain: {
--
2.39.2
More information about the pve-devel
mailing list