folder: IMAP: fix issue when the response of searchforheaders is the same UID multiple times

When the IMAP server doesn't support the UIDPLUS extension so we fallback on the
internal legacy way of mapping the UID to the uploaded message (with the email
header). If the server responds with 2 UIDs offlineimap doesn't know which one
is correct and reports an error.

If for some reason all the returned UIDs are equals it's very likely fine to
map either one.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Tested-by: https://github.com/mpsq
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/676
This commit is contained in:
Nicolas Sebrecht 2020-07-21 23:41:44 +02:00
parent fdb9974ab7
commit 21332efb08
1 changed files with 1 additions and 0 deletions

View File

@ -402,6 +402,7 @@ class IMAPFolder(BaseFolder):
return 0
matchinguids = matchinguids.split(' ')
matchinguids = list(set(matchinguids)) # Remove duplicates.
self.ui.debug('imap', '__savemessage_searchforheader: matchinguids now '
+ repr(matchinguids))
if len(matchinguids) != 1 or matchinguids[0] is None: