Repository navigation
Email: open folders with a space in the name, and don't show a cancelled load as a failure - #6
Closed
Thomaspeel6 wants to merge 2 commits into
Closed
Thomaspeel6 wants to merge 2 commits into
Thomaspeel6 wants to merge 2 commits into
Conversation
imaplib sends mailbox names verbatim, so a name containing a space reached the
server as two arguments. Every Gmail system folder except INBOX ("[Gmail]/Sent
Mail", "[Gmail]/All Mail") and any user folder with a space failed with
"EXAMINE command error: BAD Could not parse command".
Names are now sent as IMAP quoted strings wherever a folder is selected.
The inbox load runs in a .task keyed on folder and filter, so it is cancelled when the tab is switched away or the folder changes. The catch block showed that as "Couldn't load — cancelled", even over a working mailbox. A cancelled load is now ignored; the next load replaces it.
Author
|
Folded into #7 so all the email changes are in one place. The two commits here are in that branch unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small email fixes found while connecting a Gmail account. One commit each.
1. Folders with a space in the name fail to open
What: Selecting any Gmail folder other than Inbox ("[Gmail]/Sent Mail", "[Gmail]/All Mail"), or any user folder with a space in its name, shows:
Why:
imaplibsends mailbox names verbatim, so a name with a space reaches the server as two arguments.Fix: A small
imap_mailbox()helper sends the name as an IMAP quoted string, used in the four places a folder is selected (jb_email.py).2. A cancelled load is shown as "Couldn't load — cancelled"
What: Switching tabs or folders while the inbox is still loading leaves the Email tab on "Couldn't load — cancelled", even though the mailbox works.
Why: The load runs in a
.taskkeyed on folder and filter, so SwiftUI cancels it, and thecatchreports the cancellation as a failure.Fix: Ignore a cancelled load; the next one replaces it (
EmailPanel.swift).Tested
test_email_folders.py(2 tests, local fake IMAP server): an unquoted name with a space is rejected, the quoted one opens. Full backend suite passes (85 tests) on the macOS system Python./api/email/list.Part of the email setup proposal in #8.