mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-14 17:51:29 +00:00
schema: check format: parse list formats as arrays
Previously, the returned value would be only the last element or undef in case of an empty list. There's only a handful of callers of check_format() that look at the return value and AFAICT none of the exisitng ones is for a -list format. But best to avoid any future surprises. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
91477acefb
commit
31d4beb47c
@ -714,9 +714,10 @@ sub check_format {
|
|||||||
if $format_type ne 'none' && ref($registered) ne 'CODE';
|
if $format_type ne 'none' && ref($registered) ne 'CODE';
|
||||||
|
|
||||||
if ($format_type eq 'list') {
|
if ($format_type eq 'list') {
|
||||||
|
$parsed = [];
|
||||||
# Note: we allow empty lists
|
# Note: we allow empty lists
|
||||||
foreach my $v (split_list($value)) {
|
foreach my $v (split_list($value)) {
|
||||||
$parsed = $registered->($v);
|
push @{$parsed}, $registered->($v);
|
||||||
}
|
}
|
||||||
} elsif ($format_type eq 'opt') {
|
} elsif ($format_type eq 'opt') {
|
||||||
$parsed = $registered->($value) if $value;
|
$parsed = $registered->($value) if $value;
|
||||||
|
Loading…
Reference in New Issue
Block a user