Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
radicle: Skip invalid named folders
Merged did:key:z6MkkfM3...sVz5 opened 5 months ago

Instead of failing with an InvalidId err in radicle::storage::ReadStorage::repositories for repos that don’t have a valid repository ID, we should skip them and log a warning.

2 files changed +4 -2 0c70e171 7e5a1aba
modified crates/radicle/src/storage/git.rs
@@ -127,8 +127,8 @@ impl ReadStorage for Storage {
                continue;
            }
            // Skip temporary repositories
-
            if let Some(ext) = path.path().extension() {
-
                if ext == TempRepository::EXT {
+
            if let Some(ext) = path.path().extension().and_then(|s| s.to_str()) {
+
                if ext == TempRepository::EXT || TempRepository::DEPRECATED_EXT.contains(&ext) {
                    continue;
                }
            }
modified crates/radicle/src/storage/git/temp.rs
@@ -23,6 +23,8 @@ pub struct TempRepository {
impl TempRepository {
    /// Extension used for the directory
    pub(crate) const EXT: &str = "tmp";
+
    /// Extensions used in previous versions of the codebase
+
    pub(crate) const DEPRECATED_EXT: [&str; 1] = ["lock"];
    const RANDOMNESS_LENGTH: usize = 6;

    pub(super) fn new<P>(root: P, rid: RepoId, info: &UserInfo) -> Result<Self, RepositoryError>