fix hidden directory entries count on show_hidden option is disabled

This commit is contained in:
yggverse 2025-07-03 21:49:40 +03:00
parent 96c8a829d0
commit b1360eab2e

View file

@ -152,7 +152,14 @@ impl Public {
(true, _) => dirs.push(Dir { (true, _) => dirs.push(Dir {
meta, meta,
name, name,
count: fs::read_dir(e.path()).map_or(0, |i| i.count()), count: fs::read_dir(e.path()).map_or(0, |i| {
i.filter_map(Result::ok)
.filter(|e| {
self.show_hidden
|| !e.file_name().to_string_lossy().starts_with('.')
})
.count()
}),
}), }),
(_, true) => files.push(File { meta, name }), (_, true) => files.push(File { meta, name }),
_ => continue, // @TODO symlinks support? _ => continue, // @TODO symlinks support?