diff --git a/src/web/repo.rs b/src/web/repo.rs index ff276c5..b7b00ce 100644 --- a/src/web/repo.rs +++ b/src/web/repo.rs @@ -63,7 +63,7 @@ pub struct GitWebQ { //#[get("/git/{owner}/{repo}.git")] pub async fn git_main( web::Path((ownername, reponame)): web::Path<(String, String)>, - web::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) : web::Query, + query : web::Query, gitust : web::Data, auth : Option, validator : web::Data, @@ -71,6 +71,7 @@ pub async fn git_main( ) -> Result, Vec<(String, String)>>, error::Error> { // let authtorization = auth.ok_or(error::Error::Unauthorized("safe repo".to_string()))?; //let authorization = auth.and_then(|cred| validator.check_basic(&cred)).ok_or(error::Error::Unauthorized("safe repo".to_string()))?; + let web::Query(GitWebQ{commit : commitnameopt, path : pathopt, branch : branchopt}) = query; let rootname = match pathopt { None => {"".to_string()} Some(s) => { @@ -93,9 +94,9 @@ pub async fn git_main( // let user = User { name : "Hubert".to_string()}; let user = auth.map(|auth| User{name : auth.user_id().to_string()}); // il faut ajouter le commit/branch dans la query - let path = rootname.split("/").map_accum("/git/".to_string() + &repo.owner.name + "/" + &repo.name, |str_ref, b| { - let href = b + "/" + str_ref; - ((str_ref.to_string(), href.clone()), href) + let path = rootname.split("/").map_accum("/git/".to_string() + &repo.owner.name + "/" + &repo.name, |direname, b| { + let href = b + "/" + direname; + ((direname.to_string(), href.clone()), href) }).collect(); let gitrepo = GitRepo::new(format!("{}/{}/{}.git", &gitust.repo_root_path, &repo.owner.name, &repo.name).as_str())?; let root = gitrepo.get_tree(&commit, Path::new(rootname.as_str()))?;