Git client will follow 301 but 307 (#34005)
Fix #28460 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 356b707dde00f61f806c8a27879830a1d9b5b895)
This commit is contained in:
parent
f68d49cb9e
commit
50f8563c67
1 changed files with 3 additions and 1 deletions
|
@ -361,7 +361,9 @@ func RedirectToRepo(ctx *Base, redirectRepoID int64) {
|
||||||
if ctx.Req.URL.RawQuery != "" {
|
if ctx.Req.URL.RawQuery != "" {
|
||||||
redirectPath += "?" + ctx.Req.URL.RawQuery
|
redirectPath += "?" + ctx.Req.URL.RawQuery
|
||||||
}
|
}
|
||||||
ctx.Redirect(path.Join(setting.AppSubURL, redirectPath), http.StatusTemporaryRedirect)
|
// Git client needs a 301 redirect by default to follow the new location
|
||||||
|
// It's not documentated in git documentation, but it's the behavior of git client
|
||||||
|
ctx.Redirect(path.Join(setting.AppSubURL, redirectPath), http.StatusMovedPermanently)
|
||||||
}
|
}
|
||||||
|
|
||||||
func repoAssignment(ctx *Context, repo *repo_model.Repository) {
|
func repoAssignment(ctx *Context, repo *repo_model.Repository) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue