diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-10-29 19:04:25 -0700 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-10-30 10:04:25 +0800 |
commit | 513375c429435ba60a667b219bdfb00e5b760b38 (patch) | |
tree | 9f516c8d0ebbdc66808c9017df7db2ff9aa34b57 /routers/repo/branch.go | |
parent | 6e98812ecf4efb6f53d72414ca8f67b14fac6595 (diff) | |
download | gitea-513375c429435ba60a667b219bdfb00e5b760b38.tar.gz gitea-513375c429435ba60a667b219bdfb00e5b760b38.zip |
Make URL scheme unambiguous (#2408)
* Make URL scheme unambiguous
Redirect old routes to new routes
* Fix redirects to new URL scheme, and update template
* Fix branches/_new endpoints, and update integration test
Diffstat (limited to 'routers/repo/branch.go')
-rw-r--r-- | routers/repo/branch.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go index f6eca39353..c56e8e86b2 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -202,7 +202,7 @@ func CreateBranch(ctx *context.Context, form auth.NewBranchForm) { if ctx.HasError() { ctx.Flash.Error(ctx.GetErrMsg()) - ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchName) + ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()) return } @@ -216,19 +216,19 @@ func CreateBranch(ctx *context.Context, form auth.NewBranchForm) { if models.IsErrTagAlreadyExists(err) { e := err.(models.ErrTagAlreadyExists) ctx.Flash.Error(ctx.Tr("repo.branch.tag_collision", e.TagName)) - ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchName) + ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()) return } if models.IsErrBranchAlreadyExists(err) { e := err.(models.ErrBranchAlreadyExists) ctx.Flash.Error(ctx.Tr("repo.branch.branch_already_exists", e.BranchName)) - ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchName) + ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()) return } if models.IsErrBranchNameConflict(err) { e := err.(models.ErrBranchNameConflict) ctx.Flash.Error(ctx.Tr("repo.branch.branch_name_conflict", form.NewBranchName, e.BranchName)) - ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchName) + ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()) return } @@ -237,5 +237,5 @@ func CreateBranch(ctx *context.Context, form auth.NewBranchForm) { } ctx.Flash.Success(ctx.Tr("repo.branch.create_success", form.NewBranchName)) - ctx.Redirect(ctx.Repo.RepoLink + "/src/" + form.NewBranchName) + ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + form.NewBranchName) } |