]> source.dussan.org Git - rspamd.git/commitdiff
[Project] Rework images detection
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Sep 2019 14:49:16 +0000 (15:49 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Sep 2019 14:49:16 +0000 (15:49 +0100)
src/libmime/images.c
src/libmime/message.c

index 073776359ca0e05d3b5a21c2bf4afcde6fa4f29b..faa7a6b2e94688ff3fecd153b8b00b0fe4c1f4a5 100644 (file)
@@ -50,14 +50,13 @@ rspamd_images_process (struct rspamd_task *task)
 {
        guint i;
        struct rspamd_mime_part *part;
-       rspamd_ftok_t srch;
-
-       RSPAMD_FTOK_ASSIGN (&srch, "image");
 
        PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, parts), i, part) {
                if (!(part->flags & (RSPAMD_MIME_PART_TEXT|RSPAMD_MIME_PART_ARCHIVE))) {
-                       if (rspamd_ftok_cmp (&part->ct->type, &srch) == 0 &&
+                       if (part->detected_type &&
+                               strcmp (part->detected_type, "image") == 0 &&
                                part->parsed_data.len > 0) {
+
                                process_image (task, part);
                        }
                }
index cb95945fe77c91ee0b6293475acf8c27bb929112..ef725e72ce3ec913618ee5ee464e535c187c045d 100644 (file)
@@ -1368,7 +1368,6 @@ rspamd_message_process (struct rspamd_task *task)
                L = task->cfg->lua_state;
        }
 
-       rspamd_images_process (task);
        rspamd_archives_process (task);
 
        if (L && rspamd_lua_require_function (L,
@@ -1570,7 +1569,9 @@ rspamd_message_process (struct rspamd_task *task)
                }
        }
 
+       rspamd_images_process (task);
        rspamd_images_link (task);
+
        rspamd_tokenize_meta_words (task);
 }