]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix specific urls extraction
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 3 Jul 2018 11:39:43 +0000 (12:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 3 Jul 2018 11:39:43 +0000 (12:39 +0100)
lualib/lua_util.lua

index cf4636aa2862760ef64db31f2e8766cd87c705c0..5bf8dc026ad9e3573e188024fd81ab436a9f5cb0 100644 (file)
@@ -559,8 +559,10 @@ exports.extract_specific_urls = function(task, lim, need_emails, filter, prefix)
     -- We can get urls based on their eslds
     while lim > 0 do
       for _,lurls in pairs(eslds) do
-        table.insert(res, table.remove(lurls))
-        lim = lim - 1
+        if #lurls > 0 then
+          table.insert(res, table.remove(lurls))
+          lim = lim - 1
+        end
       end
     end
 
@@ -571,8 +573,10 @@ exports.extract_specific_urls = function(task, lim, need_emails, filter, prefix)
   if ntlds <= lim then
     while lim > 0 do
       for _,lurls in pairs(tlds) do
-        table.insert(res, table.remove(lurls))
-        lim = lim - 1
+        if #lurls > 0 then
+          table.insert(res, table.remove(lurls))
+          lim = lim - 1
+        end
       end
     end