fix: quote folder names in IMAP SELECT for folders with spaces

This commit is contained in:
2026-07-13 08:10:39 +08:00
parent f38259e4bb
commit e74ae8be88
2 changed files with 1 additions and 2 deletions

0
app.log Normal file
View File

View File

@@ -136,9 +136,8 @@ def fetch_unseen_emails(account: EmailAccount, skip_uids: set[bytes] | None = No
skipped = 0 skipped = 0
for folder in folders: for folder in folders:
try: try:
status, _ = conn.select(folder, readonly=True) status, _ = conn.select('"' + folder + '"', readonly=True)
if status != "OK": if status != "OK":
logger.warning("无法选择文件夹: %s", folder)
continue continue
_, data = conn.uid("SEARCH", None, "UNSEEN") _, data = conn.uid("SEARCH", None, "UNSEEN")
uids = data[0].split() if data[0] else [] uids = data[0].split() if data[0] else []