From 8153f59188bfb62a944a731fcffc78670085b675 Mon Sep 17 00:00:00 2001 From: Julian Pidancet Date: Fri, 21 Oct 2022 21:15:07 +0200 Subject: [PATCH] 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: 150aa0f498b9 ("maildir: hide invalid folders") Signed-off-by: Julian Pidancet Acked-by: Robin Jarry --- worker/maildir/container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/maildir/container.go b/worker/maildir/container.go index 156b0af..4181648 100644 --- a/worker/maildir/container.go +++ b/worker/maildir/container.go @@ -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 } }