]> source.dussan.org Git - rspamd.git/commitdiff
Fix: if not exist Date-header
authorAlexey AL <AlexeySa@users.noreply.github.com>
Sat, 7 Feb 2015 15:46:31 +0000 (18:46 +0300)
committerAndrew Lewis <nerf@judo.za.org>
Fri, 13 Feb 2015 11:34:41 +0000 (13:34 +0200)
conf/lua/rspamd.lua

index c35e15d983ea17bca74b747b8eb08ae0b09b097b..6043f243c416f888e49786950222f1d047712451 100644 (file)
@@ -80,8 +80,8 @@ rspamd_config.DATE_IN_FUTURE = function(task)
        if rspamd_config:get_api_version() >= 5 then
                local dm = task:get_date{format = 'message'}
                local dt = task:get_date{format = 'connect'}
-               -- An hour
-               if dm - dt > 7200 then
+               -- An hour
+               if dm > 0 and dm - dt > 7200 then
                        return true
                end
        end
@@ -93,7 +93,7 @@ rspamd_config.DATE_IN_PAST = function(task)
     local dm = task:get_date{format = 'message', gmt = true}
     local dt = task:get_date{format = 'connect', gmt = true}
                -- A day
-               if dt - dm > 86400 then
+               if dm > 0 and dt - dm > 86400 then
                        return true
                end
        end