[pve-devel] [PATCH v2 manager 1/1] fix #2190: URI encode SMBIOS value strings in order to allow more characters
Christian Ebner
c.ebner at proxmox.com
Fri May 10 13:08:05 CEST 2019
On some occasions e.g. license checking, the manufacturer string in the
SMBIOS settings edit has to allow characters such as whitespaces.
https://forum.proxmox.com/threads/proxmox-and-windows-rok-license-for-dell.53236/
Relies on the corresponding patch to qemu-server to pass parameter verification.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
Version 2:
- URI encode SMBIOS values
www/manager6/Parser.js | 4 ++--
www/manager6/qemu/Smbios1Edit.js | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/www/manager6/Parser.js b/www/manager6/Parser.js
index 958deae5..b95bfcf5 100644
--- a/www/manager6/Parser.js
+++ b/www/manager6/Parser.js
@@ -532,7 +532,7 @@ Ext.define('PVE.Parser', { statics: {
Ext.Array.each(value.split(','), function(p) {
var kva = p.split('=', 2);
- res[kva[0]] = kva[1];
+ res[kva[0]] = decodeURIComponent(kva[1]);
});
return res;
@@ -544,7 +544,7 @@ Ext.define('PVE.Parser', { statics: {
Ext.Object.each(data, function(key, value) {
if (value === '') { return; }
- datastr += (datastr !== '' ? ',' : '') + key + '=' + value;
+ datastr += (datastr !== '' ? ',' : '') + key + '=' + encodeURIComponent(value);
});
return datastr;
diff --git a/www/manager6/qemu/Smbios1Edit.js b/www/manager6/qemu/Smbios1Edit.js
index fdb0d150..17d3f9ec 100644
--- a/www/manager6/qemu/Smbios1Edit.js
+++ b/www/manager6/qemu/Smbios1Edit.js
@@ -38,37 +38,37 @@ Ext.define('PVE.qemu.Smbios1InputPanel', {
{
xtype: 'textfield',
fieldLabel: gettext('Manufacturer'),
- regex: /^\S+$/,
+ regex: /^[^\n\r\f\v,=]+$/,
name: 'manufacturer'
},
{
xtype: 'textfield',
fieldLabel: gettext('Product'),
- regex: /^\S+$/,
+ regex: /^[^\n\r\f\v,=]+$/,
name: 'product'
},
{
xtype: 'textfield',
fieldLabel: gettext('Version'),
- regex: /^\S+$/,
+ regex: /^[^\n\r\f\v,=]+$/,
name: 'version'
},
{
xtype: 'textfield',
fieldLabel: gettext('Serial'),
- regex: /^\S+$/,
+ regex: /^[^\n\r\f\v,=]+$/,
name: 'serial'
},
{
xtype: 'textfield',
fieldLabel: 'SKU',
- regex: /^\S+$/,
+ regex: /^[^\n\r\f\v,=]+$/,
name: 'sku'
},
{
xtype: 'textfield',
fieldLabel: gettext('Family'),
- regex: /^\S+$/,
+ regex: /^[^\n\r\f\v,=]+$/,
name: 'family'
}
];
--
2.11.0
More information about the pve-devel
mailing list