Skip hidden files in repository listing

This commit is contained in:
Alexis Sellier 2023-03-22 15:30:48 +01:00
parent e103ffbb95
commit 71cf289c52
No known key found for this signature in database
1 changed files with 9 additions and 0 deletions

View File

@ -140,6 +140,15 @@ impl Storage {
for result in fs::read_dir(&self.path)? {
let path = result?;
// Skip non-directories.
if !path.file_type()?.is_dir() {
continue;
}
// Skip hidden files.
if path.file_name().to_string_lossy().starts_with('.') {
continue;
}
let rid = Id::try_from(path.file_name()).map_err(|_| Error::Id(path.file_name()))?;
let repo = self.repository(rid)?;