From fd7427c4e50564c2428377259f988df4ed785733 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 9 Nov 2022 20:37:54 +0100 Subject: [PATCH] luci-lua-runtime: also search luci.dispatcher scope when looking up values Some legacy templates access dispatcher functions such as `build_url()` without explicit scope, which worked in the old runtime since the template view namespace was instantiated from the dispatcher. Ensure that this continues to function in the emulated runtime. Fixes: #6082 Signed-off-by: Jo-Philipp Wich --- modules/luci-lua-runtime/luasrc/template.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/luci-lua-runtime/luasrc/template.lua b/modules/luci-lua-runtime/luasrc/template.lua index b6b9af0bad..84fb8bb338 100644 --- a/modules/luci-lua-runtime/luasrc/template.lua +++ b/modules/luci-lua-runtime/luasrc/template.lua @@ -121,7 +121,7 @@ context.viewns = setmetatable({ elseif key == "resource" then return L.config.main.resourcebase else - return rawget(tbl, key) or _G[key] or L[key] + return rawget(tbl, key) or disp[key] or _G[key] or L[key] end end})