aboutsummaryrefslogtreecommitdiff
path: root/routers/api/v1/repo/branch.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-10 23:37:25 -0500
committerUnknwon <u@gogs.io>2017-03-10 23:37:25 -0500
commit3eb57370a658a648ba504776b962d1d23cc57693 (patch)
tree44b176df7c7d13f8d31717e2346e9269b49cc0ea /routers/api/v1/repo/branch.go
parentac8b1e595fa7ace7e2539276355954b2dceeb388 (diff)
api/repo: fix cannot reponse branch with slashes (#4198)
Diffstat (limited to 'routers/api/v1/repo/branch.go')
-rw-r--r--routers/api/v1/repo/branch.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go
index a141921e..1d60b7d1 100644
--- a/routers/api/v1/repo/branch.go
+++ b/routers/api/v1/repo/branch.go
@@ -7,15 +7,20 @@ package repo
import (
api "github.com/gogits/go-gogs-client"
+ "github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/routers/api/v1/convert"
)
// https://github.com/gogits/go-gogs-client/wiki/Repositories#get-branch
func GetBranch(ctx *context.APIContext) {
- branch, err := ctx.Repo.Repository.GetBranch(ctx.Params(":branchname"))
+ branch, err := ctx.Repo.Repository.GetBranch(ctx.Params("*"))
if err != nil {
- ctx.Error(500, "GetBranch", err)
+ if models.IsErrBranchNotExist(err) {
+ ctx.Error(404, "GetBranch", err)
+ } else {
+ ctx.Error(500, "GetBranch", err)
+ }
return
}