From: Vsevolod Stakhov Date: Tue, 24 Sep 2019 14:49:16 +0000 (+0100) Subject: [Project] Rework images detection X-Git-Tag: 2.0~138 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c992064bb2341a021ba5d000e0825d95420ec3b3;p=rspamd.git [Project] Rework images detection --- diff --git a/src/libmime/images.c b/src/libmime/images.c index 073776359..faa7a6b2e 100644 --- a/src/libmime/images.c +++ b/src/libmime/images.c @@ -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); } } diff --git a/src/libmime/message.c b/src/libmime/message.c index cb95945fe..ef725e72c 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -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); }