summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2016-07-06 09:57:47 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2016-07-06 09:57:47 +0300
commit8c47bdc7650eb073484f36e55850b42ae035c99d (patch)
treea00f4691d4ff378ad4e2f37f3dec47e56379e574 /src
parent6fbc387215773b50bb7813512bfc717f7242f6a6 (diff)
downloadrspamd-8c47bdc7650eb073484f36e55850b42ae035c99d.tar.gz
rspamd-8c47bdc7650eb073484f36e55850b42ae035c99d.zip
[Minor] Do not treat numbers as extensions in archived file names
Do not insert 'MIME_DOUBLE_BAD_EXTENSION' sybmol if next-to-last extension is a number.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/mime_types.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index 880a17223..8859eadbc 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -82,7 +82,8 @@ local function check_mime_type(task)
if ext then
local badness_mult = settings['bad_extensions'][ext]
if badness_mult then
- if #parts > 2 then
+ -- Check if next-to-last extension is not a number
+ if #parts > 2 and not string.match(parts[#parts - 1], '^%d+$') then
-- Double extension + bad extension == VERY bad
task:insert_result(settings['symbol_double_extension'], badness_mult, {
parts[#parts - 1],
@@ -98,7 +99,8 @@ local function check_mime_type(task)
if is_archive then
badness_mult = settings['bad_archive_extensions'][ext]
if badness_mult then
- if #parts > 2 then
+ -- Check if next-to-last extension is not a number
+ if #parts > 2 and not string.match(parts[#parts - 1], '^%d+$') then
-- We need to ensure that it is an extension, so we check for its length
if #parts[#parts - 1] <= 4 then
-- Double extension + bad extension == VERY bad