]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] Fix XML detection overriding HTML in content type detection
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 18 Feb 2026 19:01:23 +0000 (19:01 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 18 Feb 2026 19:01:23 +0000 (19:01 +0000)
commit07b5bc2dfd40f9ef7eed056c694abf4d90d91f8a
treecdd82ba109dcdf629c6012bb8ba3f3dba533fe9a
parente823db466ba0a389361fd13b024e4840af257149
[Fix] Fix XML detection overriding HTML in content type detection

HTML parts containing an embedded <?xml?> prolog (e.g. inside the body)
were misdetected as application/xml. Since xml type has no_text=true,
this excluded the HTML part from text_parts entirely, causing
has_only_html_part() to return false and MIME_HTML_ONLY to not fire.

- Remove xml binary pattern from patterns.lua (it preempted the text
  heuristic which correctly prioritises HTML)
- Guard xml text pattern so it cannot override HTML when HTML markers
  are also present
- Raise xml text pattern weight to 40 to preserve pure XML detection
lualib/lua_magic/heuristics.lua
lualib/lua_magic/patterns.lua