From 71cf289c52aa92af8c232072f889b08770205e35 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Wed, 22 Mar 2023 15:30:48 +0100 Subject: [PATCH] Skip hidden files in repository listing --- radicle/src/storage/git.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/radicle/src/storage/git.rs b/radicle/src/storage/git.rs index 6139865c..54ac640c 100644 --- a/radicle/src/storage/git.rs +++ b/radicle/src/storage/git.rs @@ -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)?;