fix: use the GhApiClient to normalize GitHub URLs

This commit is contained in:
Kristof Mattei 2024-06-28 13:30:14 -07:00
parent a39cf031f9
commit 8a0c6b68c0
No known key found for this signature in database
GPG key ID: 89668E582D199AA8

View file

@ -195,7 +195,11 @@ impl Data {
let mut repo = Url::parse(repo)?;
let mut repository_host = RepositoryHost::guess_git_hosting_services(&repo);
if repository_host == RepositoryHost::Unknown {
// gettting the redirected final url for GitHub URLs removes any trailing .git,
// this is needed for the GitHub API which doesn't consider the .git version the same
if repository_host == RepositoryHost::Unknown
|| repository_host == RepositoryHost::GitHub
{
repo = client
.remote_client()
.get_redirected_final_url(repo)