Allow create and delete folders with spaces

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) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix) 2021-08-07 15:46:37 +02:00
parent 8b7f8c3cdd
commit 81bd57e434

View File

@ -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)