[pve-devel] [PATCH v3 manager 5/5] ui/UplaodToStorage: check file extension

Lorenz Stechauner l.stechauner at proxmox.com
Tue Aug 3 14:16:40 CEST 2021


Signed-off-by: Lorenz Stechauner <l.stechauner 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 f0c6186f..ec83c581 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: "wrong file extension",
 		},
 		{
 		    xtype: 'displayfield',
-- 
2.30.2






More information about the pve-devel mailing list