From 6a5b8eb7b6b73a2e78f4db6d7eb5d4c18a410b3a Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sat, 8 Apr 2023 06:38:56 -0400 Subject: [PATCH] Fix redirect bug when creating issue from a project (#23971) (#23997) Backport #23971 by @lunny Fix #23966 Co-authored-by: Lunny Xiao --- routers/web/repo/issue.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 2b1991f262..1a17afeef3 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1150,8 +1150,8 @@ func NewIssuePost(ctx *context.Context) { } log.Trace("Issue created: %d/%d", repo.ID, issue.ID) - if ctx.FormString("redirect_after_creation") == "project" { - ctx.Redirect(ctx.Repo.RepoLink + "/projects/" + strconv.FormatInt(form.ProjectID, 10)) + if ctx.FormString("redirect_after_creation") == "project" && projectID > 0 { + ctx.Redirect(ctx.Repo.RepoLink + "/projects/" + strconv.FormatInt(projectID, 10)) } else { ctx.Redirect(issue.Link()) }