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

View File

@ -772,6 +772,10 @@ class IMAPRepository(BaseRepository):
def deletefolder(self, foldername): def deletefolder(self, foldername):
"""Delete a folder on the IMAP server.""" """Delete a folder on the IMAP server."""
# Folder names with spaces requires quotes
if ' ' in foldername:
foldername = '"' + foldername + '"'
if self.account.utf_8_support: if self.account.utf_8_support:
foldername = imaputil.utf8_IMAP(foldername) foldername = imaputil.utf8_IMAP(foldername)
imapobj = self.imapserver.acquireconnection() imapobj = self.imapserver.acquireconnection()
@ -833,6 +837,10 @@ class IMAPRepository(BaseRepository):
return return
imapobj = self.imapserver.acquireconnection() imapobj = self.imapserver.acquireconnection()
try: try:
# Folder names with spaces requires quotes
if ' ' in foldername:
foldername = '"' + foldername + '"'
if self.account.utf_8_support: if self.account.utf_8_support:
foldername = imaputil.utf8_IMAP(foldername) foldername = imaputil.utf8_IMAP(foldername)