commit a089a38: [Minor] mime_types: Do not treat numbers in brackets as double extension

Alexander Moisseev moiseev at mezonplus.ru
Fri Jan 25 20:35:05 UTC 2019


Author: Alexander Moisseev
Date: 2019-01-25 10:14:52 +0300
URL: https://github.com/rspamd/rspamd/commit/a089a38e5ca71881797683ccf0f8c00237e95573

[Minor] mime_types: Do not treat numbers in brackets as double extension
Example: PDF417(3.2.4).msi

---
 src/plugins/lua/mime_types.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index a7a859e53..6b7ddbdc9 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -854,7 +854,7 @@ local function check_mime_type(task)
       if #parts > 2 then
         -- We need to ensure that next-to-last extension is an extension,
         -- so we check for its length and if it is not a number or date
-        if #ext2 <= 4 and not string.match(ext2, '^%d+$') then
+        if #ext2 <= 4 and not string.match(ext2, '^%d+[%]%)]?$') then
 
           -- Use the greatest badness multiplier
           if not badness_mult or


More information about the Commits mailing list