]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Selectors: Optimize the case
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 Apr 2020 11:44:42 +0000 (12:44 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 Apr 2020 11:44:42 +0000 (12:44 +0100)
lualib/lua_selectors/extractors.lua

index e0d6921352bc4ef48addd5903e1d8b624c7174c0..e800e98e9feb191a01c3581916dec67e0911ff65 100644 (file)
@@ -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