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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will work to prevent a redirected repo from getting deleted, but the error message as surfaced to the user will be confusing:
HTTP 301: Moved Permanently
Based on this alone, I don't think the user will know what they did wrong. I think a better error message would print the new full name of the repo and ask the user, if they are still sure they want to delete it, to specify the new name.
statusCode == http.StatusTemporaryRedirect || | ||
statusCode == http.StatusPermanentRedirect { | ||
cs := opts.IO.ColorScheme() | ||
fmt.Fprintf(opts.IO.ErrOut, "%s Failed to delete repository: %s has changed name or transfered ownership\n", cs.FailureIcon(), fullName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with this error message as the redirect response from the server does not give the new repository name just an ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!
Don't follow redirects when trying to do repo deletion. This prevents accidentally deleting repos that have transferred ownership.