Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: Skip invalid named folders
✗ CI failure Sebastian Martinez committed 5 months ago
commit 7e5a1ababcbf3885e4dc8381b158e19190b29bf5
parent 0c70e171238a7b3a56d6c4f275ad79150753f43f
2 passed 3 failed (5 total) View logs
2 files changed +13 -2
modified crates/radicle/src/storage/git.rs
@@ -126,12 +126,22 @@ impl ReadStorage for Storage {
            if path.file_name().to_string_lossy().starts_with('.') {
                continue;
            }
-
            // Skip temporary repositories
-
            if let Some(ext) = path.path().extension() {
+

+
            if let Some(ext) = path.path().extension().and_then(|s| s.to_str()) {
                if ext == TempRepository::EXT {
+
                    // Skip temporary repositories
+
                    log::debug!(target: "storage", "Skipping temporary repository at '{}'", path.path().display());
+
                    continue;
+
                } else if "lock" == ext {
+
                    // In previous versions, the extension ".lock" was used for temporary repositories.
+
                    // This is to handle those names in a backward-compatible way.
+
                    log::debug!(target: "storage", "Skipping locked repository at '{}'", path.path().display());
                    continue;
+
                } else {
+
                    log::warn!(target: "storage", "Found path '{}' with unexpected extension '{ext}'", path.path().display());
                }
            }
+

            let rid = RepoId::try_from(path.file_name())
                .map_err(|_| Error::InvalidId(path.file_name()))?;

modified crates/radicle/src/storage/git/temp.rs
@@ -23,6 +23,7 @@ pub struct TempRepository {
impl TempRepository {
    /// Extension used for the directory
    pub(crate) const EXT: &str = "tmp";
+

    const RANDOMNESS_LENGTH: usize = 6;

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