Merge pull request #80 from thekix/master

Allow create and delete folders with spaces
This commit is contained in:
Rodolfo García Peñas (kix) 2021-08-07 15:50:55 +02:00 committed by GitHub
commit f6e9d875e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

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)