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 <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-01-24 19:11:16 +01:00
parent 6c0828b77c
commit ba52030923
1 changed files with 4 additions and 2 deletions

View File

@ -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)