diff --git a/src/root.rs b/src/root.rs index 61e405a..afd016e 100644 --- a/src/root.rs +++ b/src/root.rs @@ -1,4 +1,4 @@ -use anyhow::{Context, Result}; +use anyhow::{Context, Result, anyhow}; use std::{ ffi::{OsStr, OsString}, fs::create_dir_all, @@ -40,6 +40,9 @@ impl SrcRoot { } fn ensure_repo_checkout(&self, url: &Url) -> Result { + if url.path().is_empty() { + return Err(anyhow!("Empty repo path")); + } let repo_path = self.as_repo_path(url); if !repo_path.is_dir() { create_dir_all(&repo_path)?;