From: Vsevolod Stakhov Date: Tue, 31 Jul 2018 17:20:52 +0000 (+0100) Subject: [Fix] Fix messages insertion X-Git-Tag: 1.7.9~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=01113a325556749e5cf1697dbb238b3307bcedb0;p=rspamd.git [Fix] Fix messages insertion --- diff --git a/src/libmime/message.c b/src/libmime/message.c index 333748d16..7c0429c3c 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 ca10a94e7..944ab9dbd 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); }