From e30ae53b2a6d8f30fbe536c5425297e3de29754c Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Fri, 23 Sep 2011 14:27:25 +0200 Subject: [PATCH] Folder: Force top-level folder visiblename to '' nametrans rules can lead to different visiblename names for the top-level directory, specifically both '.' and '' (the latter was recently introduced). However, we need to be able to compare folder names to see if we need to create a new directory or whether a directory already exists, so we need to be able to compare a repositories visiblename (=transposed via nametrans rule) with another folder. To make the top-level directory comparison happen, we enforce a top-level name of '', so that comparisons work. Signed-off-by: Sebastian Spaeth --- offlineimap/folder/Base.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index d9fed70..909db30 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -39,6 +39,11 @@ class BaseFolder(object): self.name = name self.repository = repository self.visiblename = repository.nametrans(name) + # In case the visiblename becomes '.' (top-level) we use '' as + # that is the name that e.g. the Maildir scanning will return + # for the top-level dir. + if self.visiblename == '.': + self.visiblename = '' self.config = repository.getconfig() def getname(self):