mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-15 15:16:37 +00:00
Always try geting the redirected url
This would help: - redirect public gh repo `.git` to its canonical form - redirect public gh repo, which has been recently renamed - cases where redirection is needed to get the real repo This commit make it fallbacks to the previou surl, if getting the redirected url fail, in case the repository is private. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
01a09141be
commit
e0521e25ff
1 changed files with 7 additions and 10 deletions
|
@ -205,16 +205,13 @@ impl Data {
|
|||
repo: &str,
|
||||
client: &GhApiClient,
|
||||
) -> Result<RepoInfo, FetchError> {
|
||||
let mut repo = Url::parse(repo)?;
|
||||
let mut repository_host = RepositoryHost::guess_git_hosting_services(&repo);
|
||||
|
||||
if repository_host == RepositoryHost::Unknown {
|
||||
repo = client
|
||||
.remote_client()
|
||||
.get_redirected_final_url(repo)
|
||||
.await?;
|
||||
repository_host = RepositoryHost::guess_git_hosting_services(&repo);
|
||||
}
|
||||
let repo = Url::parse(repo)?;
|
||||
let mut repo = client
|
||||
.remote_client()
|
||||
.get_redirected_final_url(repo.clone())
|
||||
.await
|
||||
.unwrap_or(repo);
|
||||
let repository_host = RepositoryHost::guess_git_hosting_services(&repo);
|
||||
|
||||
let subcrate = RepoInfo::detect_subcrate(&mut repo, repository_host);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue