aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-06-13 20:42:36 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2017-06-14 08:42:36 +0800
commit5e92b82ac632043f622117419ad04e57e9c029f3 (patch)
treed53e110f6cb8e3bf22e1ce19d240b6b241053148 /routers
parent96152c38b1eb4243350f8457eee631205c8e499a (diff)
downloadgitea-5e92b82ac632043f622117419ad04e57e9c029f3.tar.gz
gitea-5e92b82ac632043f622117419ad04e57e9c029f3.zip
Fix uppercase default branch bug (#1965)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/setting.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index b2cb73cf98..a50c6a6e22 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -480,9 +480,11 @@ func ProtectedBranchPost(ctx *context.Context) {
return
}
- branch := strings.ToLower(ctx.Query("branch"))
- if ctx.Repo.GitRepo.IsBranchExist(branch) &&
- repo.DefaultBranch != branch {
+ branch := ctx.Query("branch")
+ if !ctx.Repo.GitRepo.IsBranchExist(branch) {
+ ctx.Status(404)
+ return
+ } else if repo.DefaultBranch != branch {
repo.DefaultBranch = branch
if err := ctx.Repo.GitRepo.SetDefaultBranch(branch); err != nil {
if !git.IsErrUnsupportedVersion(err) {