mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 05:00:01 +02:00
Redirects for renamed repos (#807)
* Redirects for renamed repos * Remove unused phrase from locales
This commit is contained in:
parent
e86d935175
commit
027591a3a5
29 changed files with 127 additions and 27 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue