summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-10-16 12:28:37 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-10-16 12:29:47 +0200
commitdabfc90867c47a99ae57bcba12073e2a4dbc244f (patch)
treea82b5d1f132503d2678cd6618c0b2e57399d8b44
parent54985158fb5d945801445cf1651758b8e3ff9636 (diff)
downloadpykolab-dabfc90867c47a99ae57bcba12073e2a4dbc244f.tar.gz
Escape the necessary spaces in verifying the folder to delete (#2298)
-rw-r--r--pykolab/cli/cmd_delete_mailbox.py4
-rw-r--r--pykolab/imap/cyrus.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/pykolab/cli/cmd_delete_mailbox.py b/pykolab/cli/cmd_delete_mailbox.py
index 61bc278..0ef83fb 100644
--- a/pykolab/cli/cmd_delete_mailbox.py
+++ b/pykolab/cli/cmd_delete_mailbox.py
@@ -52,6 +52,10 @@ def execute(*args, **kw):
delete_folders = imap.list_folders(delete_folder)
+ if len(delete_folders) == 0:
+ print >> sys.stderr, _("No such folder(s)")
+ sys.exit(1)
+
for delete_folder in delete_folders:
imap.delete_mailfolder(delete_folder)
diff --git a/pykolab/imap/cyrus.py b/pykolab/imap/cyrus.py
index 9fa6feb..6034b48 100644
--- a/pykolab/imap/cyrus.py
+++ b/pykolab/imap/cyrus.py
@@ -376,7 +376,10 @@ class Cyrus(cyruslib.CYRUS):
if not mbox['domain'] == None:
verify_folder_search = "%s@%s" % (verify_folder_search, mbox['domain'])
- folders = self.lm(verify_folder_search)
+ if ' ' in verify_folder_search:
+ folders = self.lm('"%s"' % verify_folder_search)
+ else:
+ folders = self.lm(verify_folder_search)
# NOTE: Case also covered is valid hexadecimal folders; won't be the
# actual check as intended, but doesn't give you anyone else's data