From: Vsevolod Stakhov Date: Sat, 13 Mar 2021 11:00:47 +0000 (+0000) Subject: [Fix] Lua_maps: Fix adjustments for the map type in the complex map definitions X-Git-Tag: 3.0~585 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d8a5db7faecaa395fcd7d471ef65b39685bd625;p=thirdparty%2Frspamd.git [Fix] Lua_maps: Fix adjustments for the map type in the complex map definitions --- diff --git a/lualib/lua_maps.lua b/lualib/lua_maps.lua index 77aa298e5e..a3dc88053b 100644 --- a/lualib/lua_maps.lua +++ b/lualib/lua_maps.lua @@ -153,6 +153,20 @@ local function rspamd_map_add_from_ucl(opt, mtype, description) end if opt[1] then + -- Adjust each element if needed + local adjusted + for i,source in ipairs(opt) do + local nsrc,ntype = maybe_adjust_type(source, mtype) + + if mtype ~= ntype then + if not adjusted then + mtype = ntype + end + adjusted = true + end + opt[i] = nsrc + end + if mtype == 'radix' then if string.find(opt[1], '^%d') then