diff options
-rw-r--r-- | modules/context/repo.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index 1742683d3c..1a0263a330 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -451,11 +451,20 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { owner, err = user_model.GetUserByName(ctx, userName) if err != nil { if user_model.IsErrUserNotExist(err) { + // go-get does not support redirects + // https://github.com/golang/go/issues/19760 if ctx.FormString("go-get") == "1" { EarlyResponseForGoGetMeta(ctx) return } - ctx.NotFound("GetUserByName", nil) + + if redirectUserID, err := user_model.LookupUserRedirect(userName); err == nil { + RedirectToUser(ctx, userName, redirectUserID) + } else if user_model.IsErrUserRedirectNotExist(err) { + ctx.NotFound("GetUserByName", nil) + } else { + ctx.ServerError("LookupUserRedirect", err) + } } else { ctx.ServerError("GetUserByName", err) } |