From adf3a22a1ff154703803827117653aa2400ed08d Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Mon, 25 Nov 2013 21:19:40 +0200 Subject: model: disallow references to ancestors --- acf2/model/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'acf2/model/init.lua') diff --git a/acf2/model/init.lua b/acf2/model/init.lua index 27a2e32..6b89384 100644 --- a/acf2/model/init.lua +++ b/acf2/model/init.lua @@ -90,9 +90,11 @@ function M.Reference:meta(context) for k, v in node.pairs(obj) do if isinstance(v, node.TreeNode) then v = node.path(v) - v = {value=v, ['ui-value']=pth.name(v), path=true} + v = not pth.is_subordinate(context.path, v) and { + value=v, ['ui-value']=pth.name(v), path=true + } or nil else v = {value=pth.escape(v), ['ui-value']=v} end - table.insert(res.choice, v) + if v then table.insert(res.choice, v) end end return res -- cgit v1.2.3