From: Christopher Warrington Date: Mon, 3 Mar 2008 08:00:33 +0000 (-0600) Subject: fixed off-by-one error in imap.rb and maildir.rb X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=a828cc9542555d1c6fba0b3ade3b4a9ae16681dc;p=sup fixed off-by-one error in imap.rb and maildir.rb The end_offset reported by imap and maildir sources was incorrect if there was only one message in the source. Since end_offset is exclusive, we must add one to the last known id to get include all valid message ids in the range. --- diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index e785597..1d36976 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -176,7 +176,7 @@ class IMAP < Source def end_offset unsynchronized_scan_mailbox - @ids.last + @ids.last + 1 end synchronized :end_offset diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb index 5c9600d..584e657 100644 --- a/lib/sup/maildir.rb +++ b/lib/sup/maildir.rb @@ -123,7 +123,7 @@ class Maildir < Source def end_offset scan_mailbox :rescan => true - @ids.last + @ids.last + 1 end def pct_done; 100.0 * (@ids.index(cur_offset) || 0).to_f / (@ids.length - 1).to_f; end