diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-06 18:03:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-06 18:03:09 +0100 |
commit | c9af91f7ecf9d7a39ac2e07dbc7168462ab24de8 (patch) | |
tree | e37b68538f9cb93a36640bd4b286a271182736cd /lualib/lua_magic/init.lua | |
parent | bd13783018884a90571d1e94754e8bbf81369b82 (diff) | |
download | rspamd-c9af91f7ecf9d7a39ac2e07dbc7168462ab24de8.tar.gz rspamd-c9af91f7ecf9d7a39ac2e07dbc7168462ab24de8.zip |
[Project] Lua_magic: Some tweaks
Diffstat (limited to 'lualib/lua_magic/init.lua')
-rw-r--r-- | lualib/lua_magic/init.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lualib/lua_magic/init.lua b/lualib/lua_magic/init.lua index 4ecc66afa..2dbd24da5 100644 --- a/lualib/lua_magic/init.lua +++ b/lualib/lua_magic/init.lua @@ -72,7 +72,7 @@ local function process_patterns(log_obj) if not compiled_patterns then for ext,pattern in pairs(patterns) do - assert(types[ext]) + assert(types[ext], 'not found type: ' .. ext) pattern.ext = ext for _,match in ipairs(pattern.matches) do if match.string then @@ -250,6 +250,7 @@ exports.detect = function(input, log_obj) return extensions[1],types[extensions[1]] end + -- No way, let's check data in chunks or just the whole input if it is small enough if #input > exports.chunk_size * 3 then -- Chunked version as input is too long local chunk1, chunk2, chunk3 = @@ -270,7 +271,8 @@ exports.detect = function(input, log_obj) compiled_patterns, processed_patterns, log_obj, res) end else - assert(0) + -- Table input is NYI + assert(0, 'table input for match') end local extensions = process_detected(res) |