From: Alexander Moisseev Date: Wed, 6 Jul 2016 06:57:47 +0000 (+0300) Subject: [Minor] Do not treat numbers as extensions in archived file names X-Git-Tag: 1.3.0~154^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F702%2Fhead;p=rspamd.git [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. --- 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