From 21332efb08226ce9670c09154d1bbd2a26914013 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Tue, 21 Jul 2020 23:41:44 +0200 Subject: [PATCH] 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 Tested-by: https://github.com/mpsq Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/676 --- offlineimap/folder/IMAP.py | 1 + 1 file changed, 1 insertion(+) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index ead4396..923b50a 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -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: