From 08461569b4ef12a5651ffb4ef7af064370e6758a Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Fri, 8 Dec 2017 10:57:07 +0300 Subject: [PATCH] [Fix] mime_types: fix next-to-last extension length check --- src/plugins/lua/mime_types.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua index 9dee24c6b..0f88e557b 100644 --- a/src/plugins/lua/mime_types.lua +++ b/src/plugins/lua/mime_types.lua @@ -110,9 +110,9 @@ local function check_mime_type(task) local function check_extension(badness_mult, badness_mult2) if not badness_mult and not badness_mult2 then return end if #parts > 2 then - -- We need to ensure that it is an extension, so we check for its length - -- Check if next-to-last extension is not a number or date - if #ext <= 4 and ext2 and not string.match(ext2, '^%d+$') 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 -- Use the greatest badness multiplier if not badness_mult or -- 2.39.5