]> git.proxmox.com Git - pve-common.git/commitdiff
Make configid regex public
authorDominic Jäger <d.jaeger@proxmox.com>
Wed, 28 Oct 2020 10:04:53 +0000 (11:04 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 29 Oct 2020 14:20:40 +0000 (15:20 +0100)
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
src/PVE/JSONSchema.pm

index e8d7395a858619a13668d5a570671f57198803a7..29ada5bc06570ea6853ca0736e303f5fd89befa5 100644 (file)
@@ -21,6 +21,8 @@ parse_property_string
 register_standard_option
 );
 
+our $CONFIGID_RE = qr/[a-z][a-z0-9_-]+/i;
+
 # Note: This class implements something similar to JSON schema, but it is not 100% complete.
 # see: http://tools.ietf.org/html/draft-zyp-json-schema-02
 # see: http://json-schema.org/
@@ -177,7 +179,7 @@ register_format('pve-configid', \&pve_verify_configid);
 sub pve_verify_configid {
     my ($id, $noerr) = @_;
 
-    if ($id !~ m/^[a-z][a-z0-9_-]+$/i) {
+    if ($id !~ m/^$CONFIGID_RE$/) {
        return undef if $noerr;
        die "invalid configuration ID '$id'\n";
     }