commit 7677fcf: [Minor] Fix plain Lua compatibility

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Mar 8 01:00:06 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-03-07 19:56:03 -0500
URL: https://github.com/rspamd/rspamd/commit/7677fcfec0c89f0068e795f333d6f0de9103f275 (HEAD -> master)

[Minor] Fix plain Lua compatibility

---
 lualib/lua_fuzzy.lua | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lualib/lua_fuzzy.lua b/lualib/lua_fuzzy.lua
index 683c57372..8547a5dbc 100644
--- a/lualib/lua_fuzzy.lua
+++ b/lualib/lua_fuzzy.lua
@@ -245,8 +245,15 @@ local function mime_types_check(task, part, rule)
   if not t then return false, false end
 
   local ct = string.format('%s/%s', t, st)
+
+  local detected_ct
   t,st = part:get_detected_type()
-  local detected_ct = string.format('%s/%s', t, st)
+  if t then
+    detected_ct = string.format('%s/%s', t, st)
+  else
+    detected_ct = ct
+  end
+
   local id = part:get_id()
   lua_util.debugm(N, task, 'check binary part %s: %s', id, ct)
 


More information about the Commits mailing list