commit d1ad30a: [Minor] Another fix to extract_specific

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Aug 30 13:07:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-08-30 14:05:08 +0100
URL: https://github.com/rspamd/rspamd/commit/d1ad30ae1aad11e4bde0d889d9fd19b1fe41c499 (HEAD -> master)

[Minor] Another fix to extract_specific

---
 lualib/lua_util.lua                              | 10 +---------
 test/lua/unit/lua_util.extract_specific_urls.lua |  1 -
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index b37ffd61d..39150dbe6 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -655,14 +655,6 @@ exports.filter_specific_urls = function (urls, params)
 
   if params.filter then urls = fun.totable(fun.filter(params.filter, urls)) end
 
-  if #urls <= params.limit and #urls <= params.esld_limit then
-    if params.task and not params.no_cache then
-      params.task:cache_set(cache_key, urls)
-    end
-
-    return urls
-  end
-
   -- Filter by tld:
   local tlds = {}
   local eslds = {}
@@ -888,7 +880,7 @@ exports.extract_specific_urls = function(params_or_task, lim, need_emails, filte
     }
   end
   for k,v in pairs(default_params) do
-    if not params[k] then params[k] = v end
+    if type(params[k]) == 'nil' and v ~= nil then params[k] = v end
   end
 
   local urls = params.task:get_urls(params.need_emails)
diff --git a/test/lua/unit/lua_util.extract_specific_urls.lua b/test/lua/unit/lua_util.extract_specific_urls.lua
index 73491ecb3..8e225b8fa 100644
--- a/test/lua/unit/lua_util.extract_specific_urls.lua
+++ b/test/lua/unit/lua_util.extract_specific_urls.lua
@@ -102,7 +102,6 @@ context("Lua util - extract_specific_urls plain", function()
     "domain1.org",
     "domain2.org",
     "domain3.org",
-    "domain3.org",
     "test.com",
   }
 


More information about the Commits mailing list