[pve-devel] [PATCH manager v2 1/2] refactor DnsName regex

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Jul 15 11:55:45 CEST 2016


applied both patches

On Tue, Jul 12, 2016 at 02:41:27PM +0200, Dominik Csapak wrote:
> we will need this again
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> changes to v1:
> * make DnsName a string, so that we can reuse it for
>   the hostport regexes
>  www/manager6/Toolkit.js | 4 ++--
>  www/manager6/Utils.js   | 3 +++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js
> index 30d8f78..decaab6 100644
> --- a/www/manager6/Toolkit.js
> +++ b/www/manager6/Toolkit.js
> @@ -1,4 +1,4 @@
> -/*global IP4_match, IP4_cidr_match, IP6_match, IP6_cidr_match, IP64_match*/
> +/*global IP4_match, IP4_cidr_match, IP6_match, IP6_cidr_match, IP64_match, DnsName_match*/
>  // ExtJS related things
>  
>  PVE.Utils.toolkit = 'extjs';
> @@ -93,7 +93,7 @@ Ext.apply(Ext.form.field.VTypes, {
>      HttpProxyText: gettext('Example') + ": http://username:password@host:port/",
>  
>      DnsName: function(v) {
> -	return (/^(([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)\.)*([A-Za-z0-9]([A-Za-z0-9\-]*[A-Za-z0-9])?)$/).test(v);
> +	return DnsName_match.test(v);
>      },
>      DnsNameText: gettext('This is not a valid DNS name'),
>  
> diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
> index 36c551c..7ed2560 100644
> --- a/www/manager6/Utils.js
> +++ b/www/manager6/Utils.js
> @@ -56,6 +56,9 @@ var IP6_bracket_match = new RegExp("^\\[(" + IPV6_REGEXP + ")\\]");
>  
>  var IP64_match = new RegExp("^(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + ")$");
>  
> +var DnsName_REGEXP = "(?:(([a-zA-Z0-9]([a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*([A-Za-z0-9]([A-Za-z0-9\\-]*[A-Za-z0-9])?))";
> +var DnsName_match = new RegExp("^" + DnsName_REGEXP + "$");
> +
>  Ext.define('PVE.Utils', { statics: {
>  
>      // this class only contains static functions
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 



More information about the pve-devel mailing list