]> git.proxmox.com Git - pve-common.git/commitdiff
Fix indexed parameter conversion in documentation
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 19 Apr 2016 09:47:55 +0000 (11:47 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 19 Apr 2016 10:29:31 +0000 (12:29 +0200)
this would previously convert properties that matched
'^([a-z]+)(\d+)$' even if they were not part of an indexed
properties series (which always start with 0).

This fixes previously wrongly converted properties:
-smbios1
-server2

src/PVE/RESTHandler.pm

index ca3f99b5b58e8a948cf9976db8ef4e76b94670ba..1823b012cf6b4553c1fd71abdc7fa7603727b09c 100644 (file)
@@ -570,8 +570,10 @@ sub usage_str {
        if ($k =~ m/^([a-z]+)(\d+)$/) {
            my $name = $1;
            next if $idx_param->{$name};
-           $idx_param->{$name} = 1;
-           $base = "${name}[n]";
+           if ($2 == 0) {
+               $idx_param->{$name} = 1;
+               $base = "${name}[n]";
+           }
        }
 
        my $mapping = defined($stringfilemap) ? &$stringfilemap($name) : undef;
@@ -634,8 +636,10 @@ sub dump_properties {
        if ($k =~ m/^([a-z]+)(\d+)$/) {
            my $name = $1;
            next if $idx_param->{$name};
-           $idx_param->{$name} = 1;
-           $base = "${name}[n]";
+           if ($2 == 0) {
+               $idx_param->{$name} = 1;
+               $base = "${name}[n]";
+           }
        }
 
        $raw .= &$get_property_description($base, $style, $phash, $format, 0);