Browse Source

Fix route handler order (#2409)

* Fix route handler order

* Fix more routes
Ethan Koenig 3 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

@@ -597,7 +597,7 @@ func RegisterRoutes(m *macaron.Macaron) {
597 597
 			m.Get("/*", repo.WikiRaw)
598 598
 		}, repo.MustEnableWiki, context.CheckUnit(models.UnitTypeWiki), context.CheckUnit(models.UnitTypeWiki))
599 599
 
600
-		m.Get("/archive/*", repo.MustBeNotBare, repo.Download, context.CheckUnit(models.UnitTypeCode))
600
+		m.Get("/archive/*", repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode), repo.Download)
601 601
 
602 602
 		m.Group("/pulls/:index", func() {
603 603
 			m.Get("/commits", context.RepoRef(), repo.ViewPullCommits)
@@ -617,10 +617,11 @@ func RegisterRoutes(m *macaron.Macaron) {
617 617
 			m.Get("/src/*", repo.SetEditorconfigIfExists, repo.Home)
618 618
 			m.Get("/forks", repo.Forks)
619 619
 		}, context.RepoRef(), context.CheckUnit(models.UnitTypeCode))
620
-		m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.MustBeNotBare, repo.RawDiff, context.CheckUnit(models.UnitTypeCode))
620
+		m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)",
621
+			repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode), repo.RawDiff)
621 622
 
622 623
 		m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", repo.SetEditorconfigIfExists,
623
-			repo.SetDiffViewStyle, repo.MustBeNotBare, repo.CompareDiff, context.CheckUnit(models.UnitTypeCode))
624
+			repo.SetDiffViewStyle, repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode), repo.CompareDiff)
624 625
 	}, ignSignIn, context.RepoAssignment(), context.UnitTypes(), context.LoadRepoUnits())
625 626
 	m.Group("/:username/:reponame", func() {
626 627
 		m.Get("/stars", repo.Stars)