From 15f2fc3c30923d12d32e9d306411aacfceb42d31 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 7 Dec 2015 13:48:14 -0600 Subject: [PATCH] Add dblquotes around folder name on IMAP lookup. --- fanficfare/geturls.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fanficfare/geturls.py b/fanficfare/geturls.py index feff4b5..8a4bf7f 100644 --- a/fanficfare/geturls.py +++ b/fanficfare/geturls.py @@ -186,7 +186,12 @@ def get_urls_from_imap(srv,user,passwd,folder,markread=True): mail.login(user, passwd) mail.list() # Out: list of "folders" aka labels in gmail. - mail.select(folder) # , readonly=True connect to inbox. + mail.select('"%s"'%folder) # Needs to be quoted incase there are + # spaces, etc. imaplib doesn't + # correctly quote folders with spaces. + # However, it does check and won't + # quote strings that already start and + # end with ", so this is safe. result, data = mail.uid('search', None, "UNSEEN")