From f7259f044122555a9d0c01ad0ec96f4798ddbd7e Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Sun, 24 Aug 2025 14:55:52 +0200 Subject: [PATCH] fix: empty repo path e.g. when resolving the string "helix" and interpreting it as a URL because no matching local repo has been found --- src/root.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)?;