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

Dominik Csapak d.csapak at proxmox.com
Fri Nov 5 09:12:44 CET 2021


one nit inline

On 8/31/21 12:16, Lorenz Stechauner wrote:
> 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",

i'd put the errortext into a gettext

>   		},
>   		{
>   		    xtype: 'displayfield',
> 






More information about the pve-devel mailing list