summaryrefslogtreecommitdiffstats
path: root/modules/context
diff options
context:
space:
mode:
authorJames E. Blair <corvus@inaugust.com>2019-04-24 22:51:40 -0700
committerLauris BH <lauris@nix.lv>2019-04-25 08:51:40 +0300
commitdabee9b1a4347b0003c36f0f2a0548e5fa4002f7 (patch)
tree3145d39be1b48b0d64f195d62dc2787c1b3b37d3 /modules/context
parent0064535ad28f85fb8c84a0237ea02bd432c6a1f6 (diff)
downloadgitea-dabee9b1a4347b0003c36f0f2a0548e5fa4002f7.tar.gz
gitea-dabee9b1a4347b0003c36f0f2a0548e5fa4002f7.zip
Handle redirects in git clone commands (#6688)
Add support for repo_redirect objects in the git smart http handler so that when a user clones a repo that has been moved or renamed, they are redirected to the new location. This requires that the query string be included in the redirect as well, so that is added. Signed-off-by: James E. Blair <jeblair@redhat.com>
Diffstat (limited to 'modules/context')
-rw-r--r--modules/context/repo.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 4670e01564..770296b390 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -223,6 +223,9 @@ func RedirectToRepo(ctx *Context, redirectRepoID int64) {
fmt.Sprintf("%s/%s", repo.MustOwnerName(), repo.Name),
1,
)
+ if ctx.Req.URL.RawQuery != "" {
+ redirectPath += "?" + ctx.Req.URL.RawQuery
+ }
ctx.Redirect(redirectPath)
}