rest: register method: non-capturing group for path regex outer group
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 17 Nov 2020 15:05:04 +0000 (16:05 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 17 Nov 2020 15:20:15 +0000 (16:20 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/RESTHandler.pm

index 60731acf11375a3db1b8d57af91e5834753dd3ea..b0bb431d295ece5f1b9a747371e96c337325c977 100644 (file)
@@ -255,9 +255,9 @@ sub register_method {
     foreach my $comp (split(/\/+/, $info->{path})) {
        die "$errprefix path compoment has zero length\n" if $comp eq '';
        my ($name, $regex);
-       if ($comp =~ m/^\{(\w+)(:(.*))?\}$/) {
+       if ($comp =~ m/^\{(\w+)(?::(.*))?\}$/) {
            $name = $1;
-           $regex = $3 ? $3 : '\S+';
+           $regex = $2 ? $2 : '\S+';
            push @$match_re, $regex;
            push @$match_name, $name;
        } else {