From: Jo-Philipp Wich Date: Wed, 26 Oct 2022 07:49:02 +0000 (+0200) Subject: luci-lua-runtime: ensure proper forwarding of route arguments to cbi action X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ca57291bdd3afbeae073ee315305d1ecc57f7f76;p=project%2Fluci.git 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 --- diff --git a/modules/luci-lua-runtime/luasrc/dispatcher.lua b/modules/luci-lua-runtime/luasrc/dispatcher.lua index 8889853b98..7859ba17a3 100644 --- a/modules/luci-lua-runtime/luasrc/dispatcher.lua +++ b/modules/luci-lua-runtime/luasrc/dispatcher.lua @@ -392,7 +392,7 @@ function cbi(model, config) ["type"] = "call", ["module"] = "luci.dispatcher", ["function"] = "invoke_cbi_action", - ["parameters"] = { model, config }, + ["parameters"] = { model, config or {} }, ["post"] = { ["cbi.submit"] = true }