X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FRESTHandler.pm;h=4b67c614f336c1fc52c1a70d0234847163aa6b95;hp=fc220a6018481d48bc2ab75b8aa39eb3728964b2;hb=25d9bda94127b1a91181cd80bb9948093dea389b;hpb=534d42709838dce93d7e4258cf84dcb816125c40 diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index fc220a6..4b67c61 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -34,7 +34,7 @@ sub api_clone_schema { my $pd = $d->{$p}; if ($p =~ m/^([a-z]+)(\d+)$/) { my ($name, $idx) = ($1, $2); - if ($idx == 0) { + if ($idx == 0 && defined($d->{"${name}1"})) { $p = "${name}[n]"; } elsif (defined($d->{"${name}0"})) { next; # only handle once for -xx0, but only if -xx0 exists @@ -443,7 +443,7 @@ my $get_property_description = sub { if ($fileparams && $type eq 'string') { foreach my $elem (@$fileparams) { if ($name eq $elem) { - $type = 'filepath'; + $type = ''; last; } } @@ -466,7 +466,7 @@ my $get_property_description = sub { $res .= "`$type` " if $type; if (defined(my $dv = $phash->{default})) { - $res .= "(default=`$dv`)"; + $res .= "('default =' `$dv`)"; } if ($style eq 'config-sub') { @@ -591,7 +591,7 @@ sub usage_str { if ($k =~ m/^([a-z]+)(\d+)$/) { my ($name, $idx) = ($1, $2); next if $idx_param->{$name}; - if ($idx == 0) { + if ($idx == 0 && defined($prop->{"${name}1"})) { $idx_param->{$name} = 1; $base = "${name}[n]"; } @@ -656,7 +656,7 @@ sub dump_properties { if ($k =~ m/^([a-z]+)(\d+)$/) { my ($name, $idx) = ($1, $2); next if $idx_param->{$name}; - if ($idx == 0) { + if ($idx == 0 && defined($prop->{"${name}1"})) { $idx_param->{$name} = 1; $base = "${name}[n]"; }