diff options
author | Ethan Koenig <etk39@cornell.edu> | 2017-06-03 01:56:36 -0400 |
---|---|---|
committer | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-06-03 00:56:36 -0500 |
commit | 2ec5dc1661084c099348ce75c21dde95c2c26d8d (patch) | |
tree | 89f6f0941da401aa6c3c0eb3d1542f5a26d3dc7e /routers | |
parent | b900c04316145a447f70d4d222398d94d74a9fb9 (diff) | |
download | gitea-2ec5dc1661084c099348ce75c21dde95c2c26d8d.tar.gz gitea-2ec5dc1661084c099348ce75c21dde95c2c26d8d.zip |
Fix 404 for external tracking issues (#1852)
* Fix 404 for external tracking issues
* Fix 404 for new/upload file
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/issue.go | 4 | ||||
-rw-r--r-- | routers/repo/issue_label.go | 4 | ||||
-rw-r--r-- | routers/routes/routes.go | 13 |
3 files changed, 15 insertions, 6 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 254e182bc7..c54cd28439 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -965,6 +965,10 @@ func DeleteComment(ctx *context.Context) { // Milestones render milestones page func Milestones(ctx *context.Context) { + MustEnableIssues(ctx) + if ctx.Written() { + return + } ctx.Data["Title"] = ctx.Tr("repo.milestones") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsMilestones"] = true diff --git a/routers/repo/issue_label.go b/routers/repo/issue_label.go index 966c2c1c53..cfbc2ae3e5 100644 --- a/routers/repo/issue_label.go +++ b/routers/repo/issue_label.go @@ -18,6 +18,10 @@ const ( // Labels render issue's labels page func Labels(ctx *context.Context) { + MustEnableIssues(ctx) + if ctx.Written() { + return + } ctx.Data["Title"] = ctx.Tr("repo.labels") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsLabels"] = true diff --git a/routers/routes/routes.go b/routers/routes/routes.go index ecb95e3785..66b4da93c3 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -473,17 +473,17 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/milestone", repo.UpdateIssueMilestone, reqRepoWriter) m.Post("/assignee", repo.UpdateIssueAssignee, reqRepoWriter) m.Post("/status", repo.UpdateIssueStatus, reqRepoWriter) - }) + }, context.CheckUnit(models.UnitTypeIssues)) m.Group("/comments/:id", func() { m.Post("", repo.UpdateCommentContent) m.Post("/delete", repo.DeleteComment) - }) + }, context.CheckUnit(models.UnitTypeIssues)) m.Group("/labels", func() { m.Post("/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel) m.Post("/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel) m.Post("/delete", repo.DeleteLabel) m.Post("/initialize", bindIgnErr(auth.InitializeLabelsForm{}), repo.InitializeLabels) - }, reqRepoWriter, context.RepoRef()) + }, reqRepoWriter, context.RepoRef(), context.CheckUnit(models.UnitTypeIssues)) m.Group("/milestones", func() { m.Combo("/new").Get(repo.NewMilestone). Post(bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost) @@ -491,7 +491,8 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/:id/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.EditMilestonePost) m.Get("/:id/:action", repo.ChangeMilestonStatus) m.Post("/delete", repo.DeleteMilestone) - }, reqRepoWriter, context.RepoRef()) + }, reqRepoWriter, context.RepoRef(), context.CheckUnit(models.UnitTypeIssues)) + m.Combo("/compare/*", repo.MustAllowPulls, repo.SetEditorconfigIfExists). Get(repo.CompareAndPullRequest). @@ -523,7 +524,7 @@ func RegisterRoutes(m *macaron.Macaron) { return } }) - }, reqSignIn, context.RepoAssignment(), context.UnitTypes(), context.LoadRepoUnits(), context.CheckUnit(models.UnitTypeIssues)) + }, reqSignIn, context.RepoAssignment(), context.UnitTypes(), context.LoadRepoUnits()) // Releases m.Group("/:username/:reponame", func() { @@ -558,7 +559,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) m.Get("/labels/", repo.RetrieveLabels, repo.Labels) m.Get("/milestones", repo.Milestones) - }, context.RepoRef(), context.CheckUnit(models.UnitTypeIssues)) + }, context.RepoRef()) // m.Get("/branches", repo.Branches) m.Post("/branches/:name/delete", reqSignIn, reqRepoWriter, repo.MustBeNotBare, repo.DeleteBranchPost) |