From 81bd57e434118226c3002d2a8ba9998fb946afa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 7 Aug 2021 15:46:37 +0200 Subject: [PATCH] Allow create and delete folders with spaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds support to create and delete folders with the space character. When the folder includes spaces, all the folder name must be quoted. Close: #58 Signed-off-by: Rodolfo García Peñas (kix) --- offlineimap/repository/IMAP.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index c86f129..6e0cdc4 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -772,6 +772,10 @@ class IMAPRepository(BaseRepository): def deletefolder(self, foldername): """Delete a folder on the IMAP server.""" + # Folder names with spaces requires quotes + if ' ' in foldername: + foldername = '"' + foldername + '"' + if self.account.utf_8_support: foldername = imaputil.utf8_IMAP(foldername) imapobj = self.imapserver.acquireconnection() @@ -833,6 +837,10 @@ class IMAPRepository(BaseRepository): return imapobj = self.imapserver.acquireconnection() try: + # Folder names with spaces requires quotes + if ' ' in foldername: + foldername = '"' + foldername + '"' + if self.account.utf_8_support: foldername = imaputil.utf8_IMAP(foldername)