Self-hosted AI workspace.
Python
fix: raise imaplib line limit for large mailboxes (#2895)
michaelxer43c31ae0081c
diff --git a/routes/email_helpers.py b/routes/email_helpers.pyindex fef29443d..43e73516f 100644--- a/routes/email_helpers.py+++ b/routes/email_helpers.py@@ -714,6 +714,10 @@ def _open_imap_connection(host: str, port: int, *, starttls: bool, timeout: intconn.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_000return conndef _imap_connect(account_id: str | None = None, owner: str = ""):