Redirects for renamed repos (#807)

* Redirects for renamed repos

* Remove unused phrase from locales
This commit is contained in:
Ethan Koenig authored and Lunny Xiao committed 2017-02-05 22:35:03 +08:00
1 parent e86d935175
commit 027591a3a5
29 files changed
+127 -27

No files matched your search

+8 -1
View File
@@ -52,7 +52,14 @@ func repoAssignment() macaron.Handler {
repo, err := models.GetRepositoryByName(owner.ID, repoName)
if err != nil {
if models.IsErrRepoNotExist(err) {
ctx.Status(404)
redirectRepoID, err := models.LookupRepoRedirect(owner.ID, repoName)
if err == nil {
context.RedirectToRepo(ctx.Context, redirectRepoID)
} else if models.IsErrRepoRedirectNotExist(err) {
ctx.Status(404)
} else {
ctx.Error(500, "LookupRepoRedirect", err)
}
} else {
ctx.Error(500, "GetRepositoryByName", err)
}