commit fe707d0: [Minor] Get rid of numeric string:match in honor of tonumber

Vsevolod Stakhov vsevolod at highsecure.ru
Thu May 7 13:42:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-05-07 14:38:09 +0100
URL: https://github.com/rspamd/rspamd/commit/fe707d0e5451b8d18e62fcb3d0028e6fc453c2da (HEAD -> master)

[Minor] Get rid of numeric string:match in honor of tonumber

---
 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 6cf306b2b..24b88da1d 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -462,7 +462,7 @@ local function check_mime_type(task)
 
                 if enc_ext
                     and settings['bad_extensions'][enc_ext]
-                    and not string.match(ext2, '^%d+$')
+                    and not tonumber(ext2)
                     and enc_ext ~= ext2 then
                   task:insert_result(settings['symbol_double_extension'], 2.0,
                       string.format("%s!=%s", ext2, enc_ext))


More information about the Commits mailing list