summaryrefslogtreecommitdiffstats
path: root/lualib/lua_magic
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-21 13:47:55 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-21 13:47:55 +0100
commit39be9db453245cf561148e3f0e17c58dec2ce747 (patch)
treeaf00f40328216488bebaee66256c8a78ba2fb7be /lualib/lua_magic
parentccfcc9433701673b6813b9396252bb36c7268f87 (diff)
downloadrspamd-39be9db453245cf561148e3f0e17c58dec2ce747.tar.gz
rspamd-39be9db453245cf561148e3f0e17c58dec2ce747.zip
[Minor] Fix tests and jpeg case
Diffstat (limited to 'lualib/lua_magic')
-rw-r--r--lualib/lua_magic/heuristics.lua8
-rw-r--r--lualib/lua_magic/types.lua4
2 files changed, 4 insertions, 8 deletions
diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index d8c134e57..04c89ba69 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -74,9 +74,6 @@ local txt_patterns = {
csv = {
[[(?:[-a-zA-Z0-9_]+\s*,){2,}(?:[-a-zA-Z0-9_]+[\r\n])]]
},
- js = {
- [[\s*function\s*\(]],
- },
}
-- Used to match pattern index and extension
@@ -303,7 +300,10 @@ exports.mime_part_heuristic = function(part, log_obj)
if part:is_image() then
local img = part:get_image()
- return img:get_type():lower(),60
+ local img_type = img:get_type():lower()
+
+ if img_type == 'jpeg' then img_type = 'jpg' end
+ return img_type,60
end
if part:is_archive() then
diff --git a/lualib/lua_magic/types.lua b/lualib/lua_magic/types.lua
index 93bfa6641..32c7cd131 100644
--- a/lualib/lua_magic/types.lua
+++ b/lualib/lua_magic/types.lua
@@ -258,10 +258,6 @@ local types = {
type = 'message',
ct = 'message/rfc822',
},
- js = {
- type = 'application',
- ct = 'application/javascript',
- },
}
return types \ No newline at end of file