From 5ccb89a412b051069ddea677ddcaa44c98b8dd27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 7 Nov 2020 16:48:09 +0100 Subject: [PATCH] BUG: Read response as string from APPENDUID We need read the response from APPENUID and convert it to string. This patch do it. --- offlineimap/folder/IMAP.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index cd20762..2ca5a04 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -150,6 +150,7 @@ class IMAPFolder(BaseFolder): # messages or the UID of the last message have changed. Otherwise # only flag changes could have occurred. retry = True # Should we attempt another round or exit? + imapdata = None while retry: retry = False imapobj = self.imapserver.acquireconnection() @@ -759,7 +760,10 @@ class IMAPFolder(BaseFolder): "appending a message. Got: %s." % str(resp)) return 0 try: - uid = int(resp[-1].split(' ')[1]) + # Convert the UID from [b'4 1532'] to ['4 1532'] + s_uid = [x.decode('utf-8') for x in resp] + # Now, read the UID field + uid = int(s_uid[-1].split(' ')[1]) except ValueError: uid = 0 # Definetly not what we should have. except Exception: