maildir: fix maildir folder listing

Previous change "maildir: hide invalid folders" prevents filepath.Walk
from descending into directories that don't contain new/, tmp/ or cur/
because the WalkDirFunc returns filepath.SkipDir.

We have to assume that these directories can be the parent of valid
maildir folders even if they're not themselves valid maildir folders, so
it is a mistake not to recurse into these subfolders. Fix it by
returning nil instead of filepath.SkipDir in the WalkDirFunc.

Fixes: 150aa0f498 ("maildir: hide invalid folders")
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Julian Pidancet 2022-10-21 21:15:07 +02:00 committed by Robin Jarry
parent a381630604
commit 8153f59188
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ func (c *Container) ListFolders() ([]string, error) {
// Drop dirs that lack {new,tmp,cur} subdirs
for _, sub := range []string{"new", "tmp", "cur"} {
if _, err := os.Stat(filepath.Join(path, sub)); os.IsNotExist(err) {
return filepath.SkipDir
return nil
}
}