commit 1f68d27: [Minor] Selectors: Optimize the case

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Apr 30 12:28:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-04-30 12:44:42 +0100
URL: https://github.com/rspamd/rspamd/commit/1f68d27762293d8de8953981b75af90729b7bc30

[Minor] Selectors: Optimize the case

---
 lualib/lua_selectors/extractors.lua | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua
index e0d692135..e800e98e9 100644
--- a/lualib/lua_selectors/extractors.lua
+++ b/lualib/lua_selectors/extractors.lua
@@ -136,7 +136,13 @@ uses any type by default)]],
       local digests = {}
       for _,p in ipairs(parts) do
         if p:get_filename() then
-          table.insert(digests, common.create_digest(p:get_content('raw_parsed'), args))
+          if not args[2] or args[2] == 'blake2' then
+            -- Optimise as we already have this hash
+            table.insert(digests, p:get_digest())
+          else
+            table.insert(digests, common.create_digest(p:get_content('raw_parsed'), args))
+          end
+
         end
       end
 


More information about the Commits mailing list