]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Add MIME_HTML_ONLY test for multipart/mixed with html and non-text attachment
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 6 Feb 2026 18:16:03 +0000 (18:16 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 6 Feb 2026 18:16:03 +0000 (18:16 +0000)
Add test case for multipart/mixed containing text/html + application/zip
to ensure MIME_HTML_ONLY fires when HTML is the only text part alongside
a non-text attachment.

test/functional/cases/001_merged/100_general.robot
test/functional/messages/mixed-html-zip.eml [new file with mode: 0644]

index 6b5dbd0b5538e099648fe14d433767741b028f22..4552f416740f1bce3d33331c5e7236ecb8a26229 100644 (file)
@@ -9,6 +9,7 @@ ${ALT_RELATED}         ${RSPAMD_TESTDIR}/messages/alternative-related.eml
 ${MIXED_RELATED_HTML}  ${RSPAMD_TESTDIR}/messages/mixed-related-html-only.eml
 ${ALT_NESTED_RFC822}   ${RSPAMD_TESTDIR}/messages/alternative-nested-rfc822.eml
 ${ALT_EMPTY_RELATED}   ${RSPAMD_TESTDIR}/messages/alternative-empty-related.eml
+${MIXED_HTML_ZIP}      ${RSPAMD_TESTDIR}/messages/mixed-html-zip.eml
 ${SETTINGS_NOSYMBOLS}  {symbols_enabled = []}
 
 *** Test Cases ***
@@ -88,3 +89,8 @@ HTML ONLY - malformed related with no children
   Scan File  ${ALT_EMPTY_RELATED}
   ...  Settings={symbols_enabled = [MIME_HTML_ONLY]}
   Expect Symbol  MIME_HTML_ONLY
+
+HTML ONLY - multipart/mixed with html and non-text attachment
+  Scan File  ${MIXED_HTML_ZIP}
+  ...  Settings={symbols_enabled = [MIME_HTML_ONLY]}
+  Expect Symbol  MIME_HTML_ONLY
diff --git a/test/functional/messages/mixed-html-zip.eml b/test/functional/messages/mixed-html-zip.eml
new file mode 100644 (file)
index 0000000..7d13736
--- /dev/null
@@ -0,0 +1,24 @@
+Return-Path: test@test.com
+From: TEST <test@test.com>
+To: Me <me@me.me>
+Subject: multipart/mixed with html and zip attachment
+MIME-Version: 1.0
+Date: Mon, 01 Jan 2024 00:00:00 +0000
+Message-ID: <mixed-html-zip@test.com>
+Content-Type: multipart/mixed; boundary="a3f1e7d94b2c80569e1f3a7d6c4b2e8f"
+
+--a3f1e7d94b2c80569e1f3a7d6c4b2e8f
+Content-Type: text/html
+
+<html>
+<body>
+<p>This is an HTML-only message with a zip attachment.</p>
+<a href="https://example.com">Click here</a>
+</body>
+</html>
+
+--a3f1e7d94b2c80569e1f3a7d6c4b2e8f
+Content-Type: application/zip; name="ComplaintLetter_1508658544.zip"
+
+UEsDBBQAAAAIAGRlZmF1bHQAAAAAAAAAAAAAAAALABAAZHVtbXkudHh0VVgMAGR1bW15
+--a3f1e7d94b2c80569e1f3a7d6c4b2e8f--