IMAP: don't try to create empty folders

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-04-09 17:35:15 +02:00
parent 7790a6ae6c
commit 9486a0dab3
2 changed files with 7 additions and 3 deletions

View File

@ -189,11 +189,12 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
dst_hash[folder.getvisiblename().replace(
dst_repo.getsep(), src_repo.getsep())] = folder
# Find new folders on src_repo.
# Find and create new folders on src_repo.
for src_name_t, src_folder in src_hash.iteritems():
# Don't create on dst_repo, if it is readonly
if not dst_repo.get_create_folders():
break
if src_folder.sync_this and not src_name_t in dst_folders:
try:
dst_repo.makefolder(src_name_t)
@ -205,7 +206,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
raise
status_repo.makefolder(src_name_t.replace(dst_repo.getsep(),
status_repo.getsep()))
# Find new folders on dst_repo.
# Find and create new folders on dst_repo.
for dst_name_t, dst_folder in dst_hash.iteritems():
if not src_repo.get_create_folders():
# Don't create missing folder on readonly repo.

View File

@ -457,9 +457,12 @@ class IMAPRepository(BaseRepository):
:param foldername: Full path of the folder to be created."""
if foldername is '':
return
if self.getreference():
foldername = self.getreference() + self.getsep() + foldername
if not foldername: # Create top level folder as folder separator
if not foldername: # Create top level folder as folder separator.
foldername = self.getsep()
self.ui.makefolder(self, foldername)
if self.account.dryrun: