diff --git a/routers/web/repo/issue_new.go b/routers/web/repo/issue_new.go index 9a941ce85714b..72a5e455fb9d7 100644 --- a/routers/web/repo/issue_new.go +++ b/routers/web/repo/issue_new.go @@ -396,8 +396,16 @@ func NewIssuePost(ctx *context.Context) { log.Trace("Issue created: %d/%d", repo.ID, issue.ID) if ctx.FormString("redirect_after_creation") == "project" && projectID > 0 { - ctx.JSONRedirect(ctx.Repo.RepoLink + "/projects/" + strconv.FormatInt(projectID, 10)) - } else { - ctx.JSONRedirect(issue.Link()) + project, err := project_model.GetProjectByID(ctx, projectID) + if err == nil { + if project.Type == project_model.TypeOrganization { + project.Owner = ctx.Repo.Owner + } else { + project.Repo = ctx.Repo.Repository + } + ctx.JSONRedirect(project.Link(ctx)) + return + } } + ctx.JSONRedirect(issue.Link()) }