From 663a156d5cef3310a2c2017e092626642eabba44 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 23 Jan 2020 18:58:46 +0000 Subject: [Fix] Fix white on white rule and add is_leaf flag --- src/lua/lua_html.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lua') diff --git a/src/lua/lua_html.c b/src/lua/lua_html.c index c0e07de36..7d7e9b7a3 100644 --- a/src/lua/lua_html.c +++ b/src/lua/lua_html.c @@ -470,7 +470,15 @@ lua_html_node_foreach_cb (GNode *n, gpointer d) rspamd_lua_setclass (ud->L, "rspamd{html_tag}", -1); lua_pushinteger (ud->L, tag->content_length); - if (lua_pcall (ud->L, 2, 1, 0) != 0) { + /* Leaf flag */ + if (g_node_first_child (n)) { + lua_pushboolean (ud->L, false); + } + else { + lua_pushboolean (ud->L, true); + } + + if (lua_pcall (ud->L, 3, 1, 0) != 0) { msg_err ("error in foreach_tag callback: %s", lua_tostring (ud->L, -1)); lua_pop (ud->L, 1); return TRUE; -- cgit v1.2.3