Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont follow redirects on repo delete #7106

Merged
merged 3 commits into from Mar 13, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/cmd/repo/delete/http.go
Expand Up @@ -10,6 +10,13 @@ import (
)

func deleteRepo(client *http.Client, repo ghrepo.Interface) error {
noRedirectClient := &http.Client{
samcoe marked this conversation as resolved.
Show resolved Hide resolved
Transport: client.Transport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}

url := fmt.Sprintf("%srepos/%s",
ghinstance.RESTPrefix(repo.RepoHost()),
ghrepo.FullName(repo))
Expand All @@ -19,7 +26,7 @@ func deleteRepo(client *http.Client, repo ghrepo.Interface) error {
return err
}

resp, err := client.Do(request)
resp, err := noRedirectClient.Do(request)
if err != nil {
return err
}
Expand Down