aboutsummaryrefslogtreecommitdiff
path: root/cmd/web.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/web.go')
-rw-r--r--cmd/web.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/cmd/web.go b/cmd/web.go
index 92fbe2a7..7f00e239 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -632,14 +632,17 @@ func runWeb(ctx *cli.Context) error {
}, ignSignIn, context.RepoAssignment(), context.RepoRef())
m.Group("/:username", func() {
- m.Group("/:reponame", func() {
- m.Get("", repo.Home)
- m.Get("\\.git$", repo.Home)
+ m.Group("", func() {
+ m.Get("/:reponame", repo.Home)
}, ignSignIn, context.RepoAssignment(true), context.RepoRef())
m.Group("/:reponame", func() {
m.Head("/tasks/trigger", repo.TriggerTask)
- m.Route("\\.git/*", "GET,POST", ignSignInAndCsrf, repo.HTTPContexter(), repo.HTTP)
+ })
+ // Use the regexp to match the repository name validation
+ m.Group("/:reponame([\\d\\w-_\\.]+\\.git$)", func() {
+ m.Get("", ignSignIn, context.RepoAssignment(true), context.RepoRef(), repo.Home)
+ m.Route("/*", "GET,POST", ignSignInAndCsrf, repo.HTTPContexter(), repo.HTTP)
})
})
// ***** END: Repository *****