Browse Source

Fix route handler order (#2409)

* Fix route handler order

* Fix more routes
tags/v1.21.12.1
Ethan Koenig Lunny Xiao 8 years ago
parent
commit
491f0ebc58
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      routers/routes/routes.go

+ 4
- 3
routers/routes/routes.go View File

@@ -597,7 +597,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/*", repo.WikiRaw)
}, repo.MustEnableWiki, context.CheckUnit(models.UnitTypeWiki), context.CheckUnit(models.UnitTypeWiki))

m.Get("/archive/*", repo.MustBeNotBare, repo.Download, context.CheckUnit(models.UnitTypeCode))
m.Get("/archive/*", repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode), repo.Download)

m.Group("/pulls/:index", func() {
m.Get("/commits", context.RepoRef(), repo.ViewPullCommits)
@@ -617,10 +617,11 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/src/*", repo.SetEditorconfigIfExists, repo.Home)
m.Get("/forks", repo.Forks)
}, context.RepoRef(), context.CheckUnit(models.UnitTypeCode))
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.MustBeNotBare, repo.RawDiff, context.CheckUnit(models.UnitTypeCode))
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)",
repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode), repo.RawDiff)

m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", repo.SetEditorconfigIfExists,
repo.SetDiffViewStyle, repo.MustBeNotBare, repo.CompareDiff, context.CheckUnit(models.UnitTypeCode))
repo.SetDiffViewStyle, repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode), repo.CompareDiff)
}, ignSignIn, context.RepoAssignment(), context.UnitTypes(), context.LoadRepoUnits())
m.Group("/:username/:reponame", func() {
m.Get("/stars", repo.Stars)


Loading…
Cancel
Save