commit 1a64f6b: [Minor] Multimap: Exclude text parts and multiparts

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Sep 18 14:56:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-18 15:54:16 +0100
URL: https://github.com/rspamd/rspamd/commit/1a64f6be2c5e8e5177ec157df737b8db96ea9ec0 (HEAD -> master)

[Minor] Multimap: Exclude text parts and multiparts

---
 src/plugins/lua/multimap.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 7afe6dfb4..aee98f6b2 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -859,7 +859,12 @@ local function multimap_callback(task, rule)
     end,
     filename = function()
       local parts = task:get_parts()
-      for _,p in ipairs(parts) do
+
+      local function filter_parts(p)
+        return (not p:is_text()) and (not p:is_multipart())
+      end
+
+      for p in fun.iter(fun.filter(filter_parts, parts)) do
         if p:is_archive() and not rule['skip_archives'] then
           local fnames = p:get_archive():get_files()
 


More information about the Commits mailing list