From 210dc90627fe8f4e1381a4990cd6fbc07c4d4828 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 8 Apr 2023 16:17:50 +0800 Subject: [PATCH] Fix redirect bug when creating issue from a project (#23971) Fix #23966 --- 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 2b1991f262d82..1a17afeef34d6 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()) }