[PATCH v2] Maildir relative paths change was not complete

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Aug 22 10:09:07 BST 2011


From: Vladimir Marek <vlmarek at volny.cz>

Commit e023f190b0eed84fefc10e28bfe5e4e0467ff257 changed the storing of
file paths in the messagelist variable to be relative paths, but we were
using the full absolute path anyway as we missed one spot.

Adapt this and construct the full file path in the one place where we
need it.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
The first version is was mising out some of the changes that should be
included, so please ignore. This one is fresh on the next branch and
contains the changes that Vladimir agreed would be needed on top of his
origin patch.

 offlineimap/folder/Maildir.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py
index f72f4ea..cedcb5d 100644
--- a/offlineimap/folder/Maildir.py
+++ b/offlineimap/folder/Maildir.py
@@ -133,7 +133,7 @@ class MaildirFolder(BaseFolder):
         folderstr = ',FMD5=' + foldermd5
         for dirannex in ['new', 'cur']:
             fulldirname = os.path.join(self.getfullname(), dirannex)
-            files.extend(os.path.join(fulldirname, filename) for
+            files.extend(os.path.join(dirannex, filename) for
                          filename in os.listdir(fulldirname))
         for file in files:
             messagename = os.path.basename(file)
@@ -151,10 +151,9 @@ class MaildirFolder(BaseFolder):
 
             #Check and see if the message is too big if the maxsize for this account is set
             if(maxsize != -1):
-                filesize = os.path.getsize(file)
-                if(filesize > maxsize):
+                size = os.path.getsize(os.path.join(self.getfullname(), file))
+                if(size > maxsize):
                     continue
-            
 
             foldermatch = messagename.find(folderstr) != -1
             if not foldermatch:
@@ -177,6 +176,7 @@ class MaildirFolder(BaseFolder):
                 flags = set(flagmatch.group(1))
             else:
                 flags = set()
+            # 'filename' is 'dirannex/filename', e.g. cur/123_U=1_FMD5=1:2,S
             retval[uid] = {'uid': uid,
                            'flags': flags,
                            'filename': file}
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list