aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-23 18:58:46 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-23 18:58:46 +0000
commit663a156d5cef3310a2c2017e092626642eabba44 (patch)
tree48027f78b6b234b4a1e76131c1ec3939f86df0af /src/lua
parent8641e1a580314988f5c80572c3507509313ab2f7 (diff)
downloadrspamd-663a156d5cef3310a2c2017e092626642eabba44.tar.gz
rspamd-663a156d5cef3310a2c2017e092626642eabba44.zip
[Fix] Fix white on white rule and add is_leaf flag
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_html.c10
1 files changed, 9 insertions, 1 deletions
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;