commit 8a1e1ec: [Minor] Test & fix has_only_html_part regression
Andrew Lewis
nerf at judo.za.org
Wed Aug 2 14:42:05 UTC 2023
Author: Andrew Lewis
Date: 2023-08-02 16:35:16 +0200
URL: https://github.com/rspamd/rspamd/commit/8a1e1ec63cf33e03bc164a7b782dbca33f97d6ab (refs/pull/4559/head)
[Minor] Test & fix has_only_html_part regression
---
src/libmime/mime_expressions.c | 2 --
test/functional/cases/001_merged/100_general.robot | 10 ++++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index 88e9e16a1..60cfe7b02 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -1470,8 +1470,6 @@ rspamd_has_only_html_part(struct rspamd_task *task, GArray *args,
PTR_ARRAY_FOREACH(MESSAGE_FIELD(task, text_parts), i, p)
{
- p = g_ptr_array_index(MESSAGE_FIELD(task, text_parts), 0);
-
if (!IS_TEXT_PART_ATTACHMENT(p)) {
if (IS_TEXT_PART_HTML(p)) {
cnt_html++;
diff --git a/test/functional/cases/001_merged/100_general.robot b/test/functional/cases/001_merged/100_general.robot
index b06dd1492..16b9b5f5a 100644
--- a/test/functional/cases/001_merged/100_general.robot
+++ b/test/functional/cases/001_merged/100_general.robot
@@ -49,3 +49,13 @@ EMAILS DETECTION ZEROFONT
... Settings={symbols_enabled = [MANY_INVISIBLE_PARTS, ZERO_FONT]}
Expect Symbol MANY_INVISIBLE_PARTS
Expect Symbol ZERO_FONT
+
+HTML ONLY - TRUE POSITIVE
+ Scan File ${RSPAMD_TESTDIR}/messages/zerofont.eml
+ ... Settings={symbols_enabled = [MIME_HTML_ONLY]}
+ Expect Symbol MIME_HTML_ONLY
+
+HTML ONLY - TRUE NEGATIVE
+ Scan File ${RSPAMD_TESTDIR}/messages/btc.eml
+ ... Settings={symbols_enabled = [MIME_HTML_ONLY]}
+ Do Not Expect Symbol MIME_HTML_ONLY
More information about the Commits
mailing list