commit 0165255: [Minor] mime_types: use higher weighted MIME type if detected MIME type differs from Content-Type header

Thomas Oettli spacefreak at noop.ch
Tue Apr 16 11:14:18 UTC 2019


Author: Thomas Oettli
Date: 2019-04-16 09:25:14 +0200
URL: https://github.com/rspamd/rspamd/commit/0165255b168b4a55056f533f9c761b36cceb29b6 (refs/pull/2852/head)

[Minor] mime_types: use higher weighted MIME type if detected MIME type differs from Content-Type header

---
 src/plugins/lua/mime_types.lua | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index 1141047a2..e621b5666 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -1086,13 +1086,12 @@ local function check_mime_type(task)
         end
 
         if map then
-          local v
+          local v = map:get_key(ct)
           local detected_different = false
           if detected_ct and detected_ct ~= ct then
-            v = map:get_key(detected_ct)
+            local v_detected = map:get_key(detected_ct)
+	    if v_detected > v then v = v_detected end
             detected_different = true
-          else
-            v = map:get_key(ct)
           end
           if v then
             local n = tonumber(v)


More information about the Commits mailing list