Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid trying to synchronize folders that have empty names
Hello, I am hitting the same issue as Jes Sorensen[1], where at some point, offlineimap 6.5.4 would error out with the message: Establishing connection to mail.corp.foo.com:993 Creating new IMAP folder '/' on server RemoteFoo ERROR: Creating folder on repository RemoteFoo Folder '/'[RemoteFoo] could not be created. Server responded: ('NO', ['CREATE failed: invalid mailbox name']) ERROR: Folder '/'[RemoteFoo] could not be created. Server responded: ('NO', ['CREATE failed: invalid mailbox name']) *** Finished account 'Foo' in 0:03 I chased it down and it looks like the issue happens when we have a local Maildir format, subfolders and where the separator is '/'. Since commit a279aa7 [2], it can happen that offlineimap wrongly tries to create a folder named '/' on the remote server. I believe the problem is that MaildirRepository._getfolders_scandir which is supposed to scan the list of IMAP folders under a given root folder can now return a folder that has an empty path. A consumer of that function then appends the IMAP folder path separator to that empty folder name, and tries to create the resulting folder name '/' on the server. Oops. The patch accompanying this message addresses the issue by ensuring that that function never yields an empty path. Though, in the grand scheme of things, I don't understand why the change in [2] would be the right fix to begin with. Is that function the right place to make nametrans related decisions? It seems to like that function ought to returns what it really sees on the physical Maildir directory. [1]: http://article.gmane.org/gmane.mail.imap.offlineimap.general/5696 [2]: commit a279aa7 Author: Sebastian Spaeth <Sebastian@SSpaeth.de> Date: Mon Sep 19 14:14:44 2011 +0200 Maildir: Call top-level directory '', not '.' If nametrans translates to an empty directory we want to find the top-level directory by name '' and not by name '.'. This unbreaks nametrans rules that result in empty folder names. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> And now the patch. Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
- Loading branch information