Browse Source

[Fix] Fix override_defaults function

tags/1.8.2
Vsevolod Stakhov 5 years ago
parent
commit
6536352d53
2 changed files with 7 additions and 4 deletions
  1. 1
    0
      lualib/lua_fuzzy.lua
  2. 6
    4
      lualib/lua_util.lua

+ 1
- 0
lualib/lua_fuzzy.lua View File

@@ -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

+ 6
- 4
lualib/lua_util.lua View File

@@ -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

Loading…
Cancel
Save