luci-lua-runtime: ensure proper forwarding of route arguments to cbi action

Ensure that the optional cbi() `config` argument is set to an empty table
if unspecified to ensure that the static call argument array is exactly
two elements long, otherwise call arguments are shifted and the invoked
method might not receive the expected parameter.

This fixes, among others, the dispatching of `arcombine()` targets.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-10-26 09:49:02 +02:00
parent 3ec7bff0d1
commit ca57291bdd

View file

@ -392,7 +392,7 @@ function cbi(model, config)
["type"] = "call", ["type"] = "call",
["module"] = "luci.dispatcher", ["module"] = "luci.dispatcher",
["function"] = "invoke_cbi_action", ["function"] = "invoke_cbi_action",
["parameters"] = { model, config }, ["parameters"] = { model, config or {} },
["post"] = { ["post"] = {
["cbi.submit"] = true ["cbi.submit"] = true
} }