commit 10155c9: [Project] Lua_magic: Use lua_magic for multimap as well

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Sep 9 16:14:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-09 17:13:12 +0100
URL: https://github.com/rspamd/rspamd/commit/10155c997eb4120efc4f35eacb63ba5a45431c3f (HEAD -> master)

[Project] Lua_magic: Use lua_magic for multimap as well

---
 src/plugins/lua/multimap.lua | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index ae97afeb8..7afe6dfb4 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -873,21 +873,14 @@ local function multimap_callback(task, rule)
           match_filename(rule, fn)
         end
         -- Also deal with detected content type
-        local dtype,dsubtype = p:get_detected_type()
-        if not rule.skip_detected and (dtype and dsubtype) then
-          local detected_ct = string.format('%s/%s', dtype, dsubtype)
-
-          if detected_ct then
-            local lua_mime = require "lua_mime"
-
-            local ext = lua_mime.reversed_extensions_map[detected_ct]
-
-            if ext then
-              local fake_fname = string.format('detected.%s', ext)
-              lua_util.debugm(N, task, 'detected filename %s (%s content-type)',
-                  fake_fname, detected_ct)
-              match_filename(rule, fake_fname)
-            end
+        if not rule.skip_detected then
+          local ext = p:get_detected_ext()
+
+          if ext then
+            local fake_fname = string.format('detected.%s', ext)
+            lua_util.debugm(N, task, 'detected filename %s',
+                fake_fname)
+            match_filename(rule, fake_fname)
           end
         end
       end


More information about the Commits mailing list