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
This commit is contained in:
parent
9161f5799d
commit
f7259f0441
1 changed files with 4 additions and 1 deletions
|
|
@ -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<PathBuf> {
|
||||
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)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue