]> source.dussan.org Git - rspamd.git/commitdiff
Fix raw vs parsed reperesentations.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 19 Nov 2014 15:19:49 +0000 (15:19 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 19 Nov 2014 15:19:49 +0000 (15:19 +0000)
Raw parts are now:
- decoded b64/qp, but *NOT* converted to utf-8

Processed parts are now:
- converted to UTF-8
- normalized if needed (e.g. HTML tags are stripped)

src/libmime/message.c
src/libserver/url.c

index f6c84e123f406b3c63d7af19d83ce7bd8986dd61..b93810cb03cc614d8441336dc702a051a3a34786 100644 (file)
@@ -1066,8 +1066,9 @@ process_text_part (struct rspamd_task *task,
                        task->text_parts = g_list_prepend (task->text_parts, text_part);
                        return;
                }
-               text_part->orig = convert_text_to_utf (task,
-                               part_content,
+               text_part->orig = part_content;
+               part_content = convert_text_to_utf (task,
+                               text_part->orig,
                                type,
                                text_part);
                text_part->is_balanced = TRUE;
@@ -1077,7 +1078,7 @@ process_text_part (struct rspamd_task *task,
                text_part->content = strip_html_tags (task,
                                task->task_pool,
                                text_part,
-                               text_part->orig,
+                               part_content,
                                NULL);
 
                if (text_part->html_nodes != NULL) {
@@ -1107,11 +1108,11 @@ process_text_part (struct rspamd_task *task,
                        task->text_parts = g_list_prepend (task->text_parts, text_part);
                        return;
                }
-               text_part->orig = convert_text_to_utf (task,
+               text_part->content = convert_text_to_utf (task,
                                part_content,
                                type,
                                text_part);
-               text_part->content = text_part->orig;
+               text_part->orig = part_content;
                url_parse_text (task->task_pool, task, text_part, FALSE);
                fuzzy_init_part (text_part, task->task_pool, task->cfg->max_diff);
                task->text_parts = g_list_prepend (task->text_parts, text_part);
index 13c7cde7a56320a97553d35ce65be4fba307bdb0..f64258625eb084afbf91ca164db8eb24838c04b6 100644 (file)
@@ -1829,7 +1829,7 @@ url_parse_text (rspamd_mempool_t * pool,
        gchar *p, *end, *begin;
 
 
-       if (!part->orig->data || part->orig->len == 0) {
+       if (part->content == NULL || part->content->len == 0) {
                msg_warn ("got empty text part");
                return;
        }