aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-02 17:42:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-02 17:42:27 +0100
commit99cdd89e0c466bef05ee42ab98d046e7f642f591 (patch)
tree2aeb1522933a9c8f6ed1034b350f2bef018833ba
parentf06ec9d2324363ceaaf7249072ec178b940795f7 (diff)
downloadrspamd-99cdd89e0c466bef05ee42ab98d046e7f642f591.tar.gz
rspamd-99cdd89e0c466bef05ee42ab98d046e7f642f591.zip
[Feature] Multimap: Also check detected charset when do filename checks
-rw-r--r--src/plugins/lua/multimap.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index b87636bd0..38052f6f0 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -865,8 +865,25 @@ local function multimap_callback(task, rule)
if fn then
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)
+ match_filename(rule, fake_fname)
+ end
+ end
+ end
end
end,
+
content = function()
match_content(rule)
end,