]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix messages insertion
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 31 Jul 2018 17:20:52 +0000 (18:20 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 31 Jul 2018 17:20:52 +0000 (18:20 +0100)
src/libmime/message.c
src/lua/lua_task.c

index 333748d16db3d3de0b1d316802ebb6a113fe7b5b..7c0429c3c9a2e68bd053f38a5ecd3656795f9441 100644 (file)
@@ -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;
index ca10a94e7d9c002ea9f74bc9f59a363b2ed6cf9d..944ab9dbd9e628f5dbc160899b1addf9f0165fa4 100644 (file)
@@ -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);
                        }