From 4b6481664fa710649eda4d3efca880c299618f9d Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 1 Jun 2024 21:24:35 -0700 Subject: [PATCH] Filter out duplicate folders --- mailbox/mailbox-lib.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mailbox/mailbox-lib.pl b/mailbox/mailbox-lib.pl index 8cd48b9e..e73062ed 100755 --- a/mailbox/mailbox-lib.pl +++ b/mailbox/mailbox-lib.pl @@ -764,6 +764,22 @@ sub list_folders } } +# Filter out duplicate folders by inode +my @frv; +my %idone; +foreach my $f (@rv) { + if (!$f->{'file'}) { + push(@frv, $f); + } + else { + my @st = stat($f->{'file'}); + if (!@st || !$done{$st[0],$st[1]}++) { + push(@frv, $f); + } + } + } +@rv = @frv; + @list_folders_cache = @rv; return @rv; }