]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Handle native boolean values in lua_util.toboolean()
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 12 Feb 2026 17:35:32 +0000 (17:35 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 12 Feb 2026 17:35:32 +0000 (17:35 +0000)
toboolean() only handled string and number inputs, falling through to
the error branch for native Lua booleans and always returning false.
This broke the fuzzy_check "checks" configuration block since UCL
converts boolean values to native Lua booleans, and apply_checks_overrides
in lua_fuzzy.lua passes them through toboolean() via bool_opt().

Fixes: #5775
lualib/lua_util.lua

index dfc9ff03341bdb7fc0f959670cb179c701695c64..bc63861c429c07c3d8b8cba6f2e78204d8facc74 100644 (file)
@@ -1750,7 +1750,9 @@ exports.toboolean = function(v)
     ['False'] = false,
   };
 
-  if type(v) == 'string' then
+  if type(v) == 'boolean' then
+    return v
+  elseif type(v) == 'string' then
     if true_t[v] == true then
       return true;
     elseif false_t[v] == false then