fix: select() on the requested folder despite a failed old-folder reselect
_connect_and_reselect_locked() re-selects the prior _selected_folder after reconnecting and returns False if that reselect fails, even when the underlying link came back live. select() gated entirely on that bool, so it returned False without ever sending a SELECT for the folder the caller actually asked for - retrieve_otp's per-folder loop then silently skips a folder a live connection could have selected, for that pass. Let select() proceed to its own SELECT whenever the connection is live (self._mail is not None), only bailing out when ensure_connection reflects an unreconnectable link. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -183,8 +183,13 @@ class IMAPClient:
|
||||
return folders
|
||||
|
||||
async def select(self, folder: str) -> bool:
|
||||
"""select a folder, returning whether it succeeded"""
|
||||
if not await self.ensure_connection():
|
||||
"""select a folder, returning whether it succeeded
|
||||
|
||||
connects/reconnects first if needed; a failed re-select of the *previously*
|
||||
selected folder during reconnect does not block attempting this call's own
|
||||
target folder, since a live connection can still select it.
|
||||
"""
|
||||
if not await self.ensure_connection() and self._mail is None:
|
||||
return False
|
||||
try:
|
||||
result, _ = await self._mail.select(f'"{folder}"')
|
||||
|
||||
Reference in New Issue
Block a user