From 01113a325556749e5cf1697dbb238b3307bcedb0 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 31 Jul 2018 18:20:52 +0100 Subject: [PATCH] [Fix] Fix messages insertion --- src/libmime/message.c | 10 +++++++--- src/lua/lua_task.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libmime/message.c b/src/libmime/message.c index 333748d16d..7c0429c3c9 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -835,9 +835,13 @@ rspamd_message_process_text_part (struct rspamd_task *task, task->result = mres; task->pre_result.action = act; task->pre_result.str = "Gtube pattern"; - ucl_object_insert_key (task->messages, - ucl_object_fromstring ("Gtube pattern"), "smtp_message", 0, - false); + + if (ucl_object_lookup (task->messages, "smtp_message") == NULL) { + ucl_object_replace_key (task->messages, + ucl_object_fromstring ("Gtube pattern"), "smtp_message", 0, + false); + } + rspamd_task_insert_result (task, GTUBE_SYMBOL, 0, NULL); return; diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index ca10a94e7d..944ab9dbd9 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1519,7 +1519,7 @@ lua_task_set_pre_result (lua_State * L) action_str = rspamd_mempool_strdup (task->task_pool, luaL_checkstring (L, 3)); task->pre_result.str = action_str; - ucl_object_insert_key (task->messages, + ucl_object_replace_key (task->messages, ucl_object_fromstring (action_str), "smtp_message", 0, false); } -- 2.47.3