[pve-devel] [PATCH http-server 2/2] use proper arrays for array parameter
Dominik Csapak
d.csapak at proxmox.com
Fri May 12 14:23:53 CEST 2023
since there is no other way to get an array parameter when using
x-www-form-urlencoded content type
the previous format with \0 separated strings (known as '-alist' format)
should not be used anymore (in favor of the now supported arrays)
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
this technically breaks the api use for '-alist' formats since the user
must \0 separate the entries themselves instead of giving them multiple
times
src/PVE/APIServer/AnyEvent.pm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index e9d87b3..e56a196 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -850,7 +850,12 @@ sub decode_urlencoded {
$v = Encode::decode('utf8', $v);
if (defined(my $old = $res->{$k})) {
- $v = "$old\0$v";
+ if (ref($old) eq 'ARRAY') {
+ push @$old, $v;
+ $v = $old;
+ } else {
+ $v = [$old, $v];
+ }
}
}
--
2.30.2
More information about the pve-devel
mailing list