fix(TAB-251): local url should be in format of file:///path/to/repo

r0.4
Meng Zhang 2023-10-23 18:41:52 -07:00
parent 422b27d2ed
commit d3331c591e
1 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ pub struct Repository {
impl Repository { impl Repository {
pub fn dir(&self) -> PathBuf { pub fn dir(&self) -> PathBuf {
if self.is_local_dir() { if self.is_local_dir() {
let path = self.git_url.strip_prefix("file:/").unwrap(); let path = self.git_url.strip_prefix("file://").unwrap();
path.into() path.into()
} else { } else {
repositories_dir().join(filenamify(&self.git_url)) repositories_dir().join(filenamify(&self.git_url))
@ -75,7 +75,7 @@ mod tests {
#[test] #[test]
fn it_parses_local_dir() { fn it_parses_local_dir() {
let repo = Repository { let repo = Repository {
git_url: "file://home/user".to_owned(), git_url: "file:///home/user".to_owned(),
}; };
assert!(repo.is_local_dir()); assert!(repo.is_local_dir());
assert_eq!(repo.dir().display().to_string(), "/home/user"); assert_eq!(repo.dir().display().to_string(), "/home/user");