]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix check plain text part
authorAL <AlexeySa@users.noreply.github.com>
Wed, 16 Nov 2016 17:22:07 +0000 (20:22 +0300)
committerGitHub <noreply@github.com>
Wed, 16 Nov 2016 17:22:07 +0000 (20:22 +0300)
src/plugins/lua/hfilter.lua

index 0bcbc52ffdb30e921a068d2aeb0782a0d1780d94..24485a9dc6d88a549296ff6f9106f0a7eec24fae 100644 (file)
@@ -255,7 +255,7 @@ local function hfilter(task)
           plain_text_part = p
         end
       end
-
+      local hc = nil
       if html_text_part then
         local hc = html_text_part:get_html()
         if hc then
@@ -279,18 +279,19 @@ local function hfilter(task)
               end
             end
           end
-        elseif plain_text_part then
-          local url_len = plain_text_part:get_urls_length()
-          local plen = plain_text_part:get_length()
-
-          if plen > 0 and url_len > 0 then
-            local rel = url_len / plen
-            if rel > 0.8 then
-              task:insert_result('HFILTER_URL_ONLY', (rel - 0.8) * 5.0)
-              local lines =  plain_text_part:get_lines_count()
-              if lines > 0 and lines < 2 then
-                task:insert_result('HFILTER_URL_ONELINE', 1.00)
-              end
+        end
+      end
+      if not hc and plain_text_part then
+        local url_len = plain_text_part:get_urls_length()
+        local plen = plain_text_part:get_length()
+
+        if plen > 0 and url_len > 0 then
+          local rel = url_len / plen
+          if rel > 0.8 then
+            task:insert_result('HFILTER_URL_ONLY', (rel - 0.8) * 5.0)            
+            local lines = plain_text_part:get_lines_count()
+            if lines > 0 and lines < 2 then
+              task:insert_result('HFILTER_URL_ONELINE', 1.00)
             end
           end
         end