Made env.json page clean up extra dots in query path

This commit is contained in:
rxi 2014-04-12 15:53:03 +01:00
parent 571e1489c3
commit 0dbc491f07

View File

@ -227,7 +227,7 @@ end
var html = "<table>"; var html = "<table>";
for (var i = 0; json.vars[i]; i++) { for (var i = 0; json.vars[i]; i++) {
var x = json.vars[i]; var x = json.vars[i];
var fullpath = (json.path + "." + x.key).replace(/^\.*/, ""); var fullpath = json.path + "." + x.key;
var k = x.key; var k = x.key;
if (x.type == "table") { if (x.type == "table") {
k = "<a href='#' onclick=\"setEnvPath('" + fullpath + "')\">" + k = "<a href='#' onclick=\"setEnvPath('" + fullpath + "')\">" +
@ -264,6 +264,7 @@ lovebird.pages["env.json"] = [[
<?lua <?lua
local t = _G local t = _G
local p = req.parsedurl.query.p or "" local p = req.parsedurl.query.p or ""
p = p:gsub("%.+", "%."):match("^[%.]*(.*)[%.]*$")
if p ~= "" then if p ~= "" then
for x in p:gmatch("[^%.]+") do for x in p:gmatch("[^%.]+") do
t = t[x] t = t[x]