From ba520309234f2024db8a3b02fed56d5c29da320f Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Tue, 24 Jan 2017 19:11:16 +0100 Subject: [PATCH] folder: IMAP: improve error message when Dovecot returns any data for UID FETCH Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/429 Signed-off-by: Nicolas Sebrecht --- offlineimap/folder/IMAP.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 360c472..e5a9742 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -760,13 +760,15 @@ class IMAPFolder(BaseFolder): # exactly one response. if res_type == 'OK': data = [res for res in data if not isinstance(res, str)] - # Could not fetch message. + + # Could not fetch message. Note: it is allowed by rfc3501 to return any + # data for the UID FETCH command. if data == [None] or res_type != 'OK' or len(data) != 1: severity = OfflineImapError.ERROR.MESSAGE reason = "IMAP server '%s' failed to fetch messages UID '%s'."\ " Server responded: %s %s"% (self.getrepository(), uids, res_type, data) - if data == [None]: + if data == [None] or len(data) < 1: # IMAP server did not find a message with this UID. reason = "IMAP server '%s' does not have a message "\ "with UID '%s'"% (self.getrepository(), uids)