]> source.dussan.org Git - rspamd.git/commitdiff
[Project] Lua_magic: Use lua_magic for multimap as well
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Sep 2019 16:13:12 +0000 (17:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Sep 2019 16:13:12 +0000 (17:13 +0100)
src/plugins/lua/multimap.lua

index ae97afeb8161950c828e6b959a1000424bd339e7..7afe6dfb4446537331f4bdad4ced6668dcd79454 100644 (file)
@@ -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