diff --git a/server/app/scripts/app.js b/server/app/scripts/app.js index 0cfb3d41..be352eaf 100644 --- a/server/app/scripts/app.js +++ b/server/app/scripts/app.js @@ -132,7 +132,7 @@ app.config(['$routeProvider', '$locationProvider', '$httpProvider', function($ro } } }) - .when('/:remote/:owner/:name/:branch/:commit', { + .when('/:remote/:owner/:name/:branch*\/:commit', { templateUrl: '/static/views/commit.html', controller: 'CommitController', title: 'Recent Commits', diff --git a/server/router/router.go b/server/router/router.go index ca5a9606..aa76f2a4 100644 --- a/server/router/router.go +++ b/server/router/router.go @@ -1,6 +1,8 @@ package router import ( + "regexp" + "github.com/drone/drone/server/handler" "github.com/drone/drone/server/middleware" @@ -36,9 +38,9 @@ func New() *web.Mux { repos.Use(middleware.SetRepo) repos.Use(middleware.RequireRepoRead) repos.Use(middleware.RequireRepoAdmin) - repos.Get("/api/repos/:host/:owner/:name/branches/:branch/commits/:commit/console", handler.GetOutput) - repos.Get("/api/repos/:host/:owner/:name/branches/:branch/commits/:commit", handler.GetCommit) - repos.Post("/api/repos/:host/:owner/:name/branches/:branch/commits/:commit", handler.PostCommit) + repos.Get(regexp.MustCompile(`^\/api\/repos\/(?P(.*))\/(?P(.*))\/(?P(.*))\/branches\/(?P(.*))\/commits\/(?P(.*))\/console$`), handler.GetOutput) + repos.Get(regexp.MustCompile(`^\/api\/repos\/(?P(.*))\/(?P(.*))\/(?P(.*))\/branches\/(?P(.*))\/commits\/(?P(.*))$`), handler.GetCommit) + repos.Post(regexp.MustCompile(`^\/api\/repos\/(?P(.*))\/(?P(.*))\/(?P(.*))\/branches\/(?P(.*))\/commits\/(?P(.*))\/console$`), handler.PostCommit) repos.Get("/api/repos/:host/:owner/:name/commits", handler.GetCommitList) repos.Get("/api/repos/:host/:owner/:name", handler.GetRepo) repos.Put("/api/repos/:host/:owner/:name", handler.PutRepo)