html array items are dropped.
matthiaz opened this issue · comments
Matthias Van Woensel commented
struct = %{"foo" => %{"lst" => [ %{"name" => "a"}, %{"name" => "b"} ]}}
struct
|> Plug.Conn.Query.encode
|> Plug.Conn.Query.decode
|> dbg
[iex:259: (file)]
struct #=> %{"foo" => %{"lst" => [%{"name" => "a"}, %{"name" => "b"}]}}
|> Plug.Conn.Query.encode() #=> "foo[lst][][name]=a&foo[lst][][name]=b"
|> Plug.Conn.Query.decode() #=> %{"foo" => %{"lst" => [%{"name" => "b"}]}}
%{"foo" => %{"lst" => [%{"name" => "b"}]}}
Expected return %{"foo" => %{"lst" => [%{"name" => "a"},%{"name" => "b"}]}}
Looks like this was introduced a couple months ago, but I can't pinpoint yet exactly when.
Version info:
plug 1.15.1
phoenix 1.7.9
elixir -v
Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Elixir 1.16.1 (compiled with Erlang/OTP 26)
José Valim commented
This was never supported because the format is ambiguous. See the red notice here: https://hexdocs.pm/plug/Plug.Conn.Query.html#decode/4 - also mentioned in the CHANGELOG: https://github.com/elixir-plug/plug/blob/main/CHANGELOG.md#v1150-2023-10-01