summaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-13 16:17:15 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-11-13 16:17:15 +0000
commit6536352d531e9c6602c59e909c88146d089e2732 (patch)
tree56e2706a0eac588ee2cc1f93389bb915959b1f19 /lualib
parentb630489b65c7a9e70ed615fa07b0450f7f7f9278 (diff)
downloadrspamd-6536352d531e9c6602c59e909c88146d089e2732.tar.gz
rspamd-6536352d531e9c6602c59e909c88146d089e2732.zip
[Fix] Fix override_defaults function
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_fuzzy.lua1
-rw-r--r--lualib/lua_util.lua10
2 files changed, 7 insertions, 4 deletions
diff --git a/lualib/lua_fuzzy.lua b/lualib/lua_fuzzy.lua
index 178d06400..bd601c038 100644
--- a/lualib/lua_fuzzy.lua
+++ b/lualib/lua_fuzzy.lua
@@ -262,6 +262,7 @@ local function mime_types_check(task, part, rule)
end
if rule.mime_types then
+
if fun.any(function(gl_re)
if gl_re:match(ct) then return true else return false end
end, rule.mime_types) then
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index 276b8e05a..8611946a1 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -520,7 +520,8 @@ local function override_defaults(def, override)
end
local res = {}
- fun.each(function(k, v)
+
+ for k,v in pairs(override) do
if type(v) == 'table' then
if def[k] and type(def[k]) == 'table' then
-- Recursively override elements
@@ -531,12 +532,13 @@ local function override_defaults(def, override)
else
res[k] = v
end
- end, override)
- fun.each(function(k, v)
+ end
+
+ for k,v in pairs(def) do
if not res[k] then
res[k] = v
end
- end, def)
+ end
return res
end