diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 11d2daeef..5b72ff79a 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -878,6 +878,11 @@ func DeleteIssue(ctx *context.Context) { return } + if issue.IsPull { + ctx.Redirect(fmt.Sprintf("%s/pulls", ctx.Repo.Repository.HTMLURL()), http.StatusSeeOther) + return + } + ctx.Redirect(fmt.Sprintf("%s/issues", ctx.Repo.Repository.HTMLURL()), http.StatusSeeOther) } diff --git a/services/issue/issue.go b/services/issue/issue.go index ded281e20..467bc14b8 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -149,7 +149,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m // delete pull request related git data if issue.IsPull { - if err := gitRepo.RemoveReference(fmt.Sprintf("%s%d", git.PullPrefix, issue.PullRequest.Index)); err != nil { + if err := gitRepo.RemoveReference(fmt.Sprintf("%s%d/head", git.PullPrefix, issue.PullRequest.Index)); err != nil { return err } }