]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Lua_scanner: allow to have multiple types in scanners
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 29 Dec 2018 10:40:01 +0000 (10:40 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 29 Dec 2018 10:40:01 +0000 (10:40 +0000)
lualib/lua_scanners/init.lua

index 149402874ecbc7da39486b42c01abaf906234390..e91feecfdcc4c2eef1941dbc081732ffd9961719 100644 (file)
@@ -48,7 +48,10 @@ end
 
 exports.filter = function(t)
   return fun.tomap(fun.filter(function(_, elt)
-    return type(elt) == 'table' and elt.type and elt.type == t
+    return type(elt) == 'table' and elt.type and (
+        (type(elt.type) == 'string' and elt.type == t) or
+        (type(elt.type) == 'table' and fun.any(function(tt) return tt == t end, elt.type))
+    )
   end, exports))
 end