mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
fix: raise imaplib line limit for large mailboxes (#2895)
Python's imaplib._MAXLINE defaults to 1 MB. Mailboxes with tens of thousands of messages exceed this on UID SEARCH ALL, crashing with 'got more than 1000000 bytes'. Set _MAXLINE to 50 MB after opening the connection so large mailboxes work without error. Fixes #2883 Co-authored-by: michaelxer <michaelxer@users.noreply.github.com>
This commit is contained in:
@@ -714,6 +714,10 @@ def _open_imap_connection(host: str, port: int, *, starttls: bool, timeout: int
|
||||
conn.sock.settimeout(timeout)
|
||||
except Exception:
|
||||
pass
|
||||
# Raise the IMAP line-length limit from the default 1 MB to 50 MB so that
|
||||
# large mailboxes (tens of thousands of messages) don't crash with
|
||||
# "got more than 1000000 bytes" on UID SEARCH ALL. (#2883)
|
||||
imaplib._MAXLINE = 50_000_000
|
||||
return conn
|
||||
|
||||
def _imap_connect(account_id: str | None = None, owner: str = ""):
|
||||
|
||||
Reference in New Issue
Block a user