]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Add missing score normalisation for HFILTER_URL_ONLY
authorAndrew Lewis <nerf@judo.za.org>
Wed, 29 Mar 2017 13:45:40 +0000 (15:45 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 29 Mar 2017 13:47:30 +0000 (15:47 +0200)
 - Issue: #1565
 - Reported by: @moisseev

src/plugins/lua/hfilter.lua

index 69fa09e4f06f5cb420fab5e5d45e3e038df2b21c..80d289d45a988054df8aaf9b02a7992e2508e096 100644 (file)
@@ -292,8 +292,9 @@ local function hfilter(task)
         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,
-              tostring(rel))
+            local sc = (rel - 0.8) * 5.0
+            if sc > 1.0 then sc = 1.0 end
+            task:insert_result('HFILTER_URL_ONLY', sc, tostring(sc))
             local lines = plain_text_part:get_lines_count()
             if lines > 0 and lines < 2 then
               task:insert_result('HFILTER_URL_ONELINE', 1.00,