diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2016-07-06 09:57:47 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2016-07-06 09:57:47 +0300 |
commit | 8c47bdc7650eb073484f36e55850b42ae035c99d (patch) | |
tree | a00f4691d4ff378ad4e2f37f3dec47e56379e574 /src | |
parent | 6fbc387215773b50bb7813512bfc717f7242f6a6 (diff) | |
download | rspamd-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.lua | 6 |
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 |