From 30f68db816c96c7783ce6a8adcc983b90b3a6f5b Mon Sep 17 00:00:00 2001 From: John L Date: Sun, 13 Jun 2021 01:29:53 -0400 Subject: [PATCH] In imaplib, deal with extra blank line Some (buggy) IMAP servers add an extra blank line after a literal value. This ignores the blank line. MacOS mail and T'bird can deal with the blank line so it seems to be a somewhat common server bug. --- Lib/imaplib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 73184396d894a38..920d5b694788420 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -1128,6 +1128,9 @@ def _get_response(self): # Read trailer - possibly containing another literal dat = self._get_line() + # ignore blank line some servers send after the counted data + if dat == b'': + dat = self._get_line() self._append_untagged(typ, dat)