From f922b8a8be13bbd3510940ee03a414e3c02992fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 19 Apr 2016 11:47:55 +0200 Subject: [PATCH] Fix indexed parameter conversion in documentation 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index ca3f99b..1823b01 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -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); -- 2.39.2