Skip to content

Commit

Permalink
maxage: don't consider negative UIDs when computing min UID
Browse files Browse the repository at this point in the history
With new emails we could have negative UIDs in come use cases. Exclude these
from the list of UIDs. The negative UIDs lead to invalid SEARCH command:

 SEARCH command error: BAD ['Could not parse command']. Data: FMAO19 SEARCH (UID -4:*)

Github-ref: #512
Tested-by: https://github.com/shubhamkrm
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
  • Loading branch information
nicolas33 committed Dec 22, 2017
1 parent e802f5f commit 0d6a9a4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions offlineimap/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ def cachemessagelists_upto_date(date):
# emails).
localfolder.cachemessagelist(min_date=date)
uids = localfolder.getmessageuidlist()
# Take care to only consider positive uids. Negative UIDs might be
# present due to new emails.
uids = [uid for uid in uids if uid > 0]
if len(uids) > 0:
# Update the remote cache list for this new min(uids).
remotefolder.cachemessagelist(min_uid=min(uids))
Expand Down

0 comments on commit 0d6a9a4

Please sign in to comment.