summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMorlinest <morlinest@gmail.com>2017-11-02 23:01:22 +0100
committerLauris BH <lauris@nix.lv>2017-11-03 00:01:22 +0200
commit1f04c00e2fb8bb3c5c300712e7c1d581db4404d7 (patch)
tree8b1a4174e5e2e3f47993a9af2aa23c707177f399 /modules
parent529f9d03ce578555d87657265cb1b25d7b81ecf6 (diff)
downloadgitea-1f04c00e2fb8bb3c5c300712e7c1d581db4404d7.tar.gz
gitea-1f04c00e2fb8bb3c5c300712e7c1d581db4404d7.zip
Fix redirect url of legacy commits route (#2825)
Diffstat (limited to 'modules')
-rw-r--r--modules/context/repo.go12
1 files changed, 1 insertions, 11 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index b2b58c4f26..8e0c584c82 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -521,16 +521,6 @@ func getRefName(ctx *Context, pathType RepoRefType) string {
return ""
}
-// URL to redirect to for deprecated URL scheme
-func repoRefRedirect(ctx *Context) string {
- urlPath := ctx.Req.URL.String()
- idx := strings.LastIndex(urlPath, ctx.Params("*"))
- if idx < 0 {
- idx = len(urlPath)
- }
- return path.Join(urlPath[:idx], ctx.Repo.BranchNameSubURL())
-}
-
// RepoRefByType handles repository reference name for a specific type
// of repository reference
func RepoRefByType(refType RepoRefType) macaron.Handler {
@@ -617,7 +607,7 @@ func RepoRefByType(refType RepoRefType) macaron.Handler {
if refType == RepoRefLegacy {
// redirect from old URL scheme to new URL scheme
- ctx.Redirect(repoRefRedirect(ctx))
+ ctx.Redirect(path.Join(setting.AppSubURL, strings.TrimSuffix(ctx.Req.URL.String(), ctx.Params("*")), ctx.Repo.BranchNameSubURL()))
return
}
}