summaryrefslogtreecommitdiffstats
path: root/routers/repo/repo.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-01-07 11:07:17 +0800
committerUnknwon <u@gogs.io>2016-01-07 11:07:17 +0800
commite0f0f72a362e98073980d9e3c70cde8cd161614b (patch)
treea72af07a4e04a0e748e27221a6076915c8a06dc8 /routers/repo/repo.go
parentca35ddd07880b71296b9f80e5f803f120bd392b4 (diff)
downloadgitea-e0f0f72a362e98073980d9e3c70cde8cd161614b.tar.gz
gitea-e0f0f72a362e98073980d9e3c70cde8cd161614b.zip
#2345 disallow access of some pages for empty repo
Diffstat (limited to 'routers/repo/repo.go')
-rw-r--r--routers/repo/repo.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 2879599744..43672ff107 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -27,6 +27,12 @@ const (
MIGRATE base.TplName = "repo/migrate"
)
+func MustBeNotBare(ctx *middleware.Context) {
+ if ctx.Repo.Repository.IsBare {
+ ctx.Handle(404, "MustBeNotBare", nil)
+ }
+}
+
func checkContextUser(ctx *middleware.Context, uid int64) *models.User {
orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.Id, "updated")
if err != nil {
@@ -232,7 +238,7 @@ func Action(ctx *middleware.Context) {
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.ID, true)
case "unstar":
err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.ID, false)
- case "desc":
+ case "desc": // FIXME: this is not used
if !ctx.Repo.IsOwner() {
ctx.Error(404)
return