[pve-devel] [PATCH v5 manager 5/5] ui/UplaodToStorage: check file extension
Lorenz Stechauner
l.stechauner at proxmox.com
Mon Nov 8 09:53:50 CET 2021
Signed-off-by: Lorenz Stechauner <l.stechauner at proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak at proxmox.com>
Tested-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/window/UploadToStorage.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/www/manager6/window/UploadToStorage.js b/www/manager6/window/UploadToStorage.js
index e79092f2..4cfd40fd 100644
--- a/www/manager6/window/UploadToStorage.js
+++ b/www/manager6/window/UploadToStorage.js
@@ -21,6 +21,7 @@ Ext.define('PVE.window.UploadToStorage', {
return {
extensions: ext.join(', '),
+ filenameRegex: RegExp('^.*(?:' + ext.join('|').replaceAll('.', '\\.') + ')$', 'i'),
};
},
@@ -186,6 +187,10 @@ Ext.define('PVE.window.UploadToStorage', {
bind: {
value: '{filename}',
},
+ cbind: {
+ regex: '{filenameRegex}',
+ },
+ regexText: gettext('Wrong file extension'),
},
{
xtype: 'displayfield',
--
2.30.2
More information about the pve-devel
mailing list