]> source.dussan.org Git - rspamd.git/commitdiff
Fix support for global maps in lua_maps.lua
authordpetrov67 <dpetrov67@gmail.com>
Tue, 14 Feb 2023 16:19:57 +0000 (11:19 -0500)
committerGitHub <noreply@github.com>
Tue, 14 Feb 2023 16:19:57 +0000 (11:19 -0500)
lualib/lua_maps.lua

index 362f543657ad079706542435468498c627c5de41..e3ce2af20e13b04f2064656fbf6db3920801b26c 100644 (file)
@@ -510,21 +510,18 @@ local function rspamd_maybe_check_map(key, what)
   end
   if type(rspamd_maps) == "table" then
     local mn
-    if starts(what, "map:") then
-      mn = string.sub(what, 4)
-    elseif starts(what, "map://") then
-      mn = string.sub(what, 6)
+    if starts(key, "map:") then
+      mn = string.sub(key, 5)
+    elseif starts(key, "map://") then
+      mn = string.sub(key, 7)
     end
 
     if mn and rspamd_maps[mn] then
-      return rspamd_maps[mn]:get_key(key)
-    else
-      return what:lower() == key
+      return rspamd_maps[mn]:get_key(what)
     end
-  else
-    return what:lower() == key
   end
 
+  return what:lower() == key
 end
 
 exports.rspamd_maybe_check_map = rspamd_maybe_check_map