diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-06 17:21:24 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-06 17:21:24 -0400 |
commit | a8e05fdf1b45578ad260aca3d239beb8be6197bf (patch) | |
tree | 990aa7217a873b6e10bb417b1489fb47133bd11c /routers/user/home.go | |
parent | 6fc210752911c62c45f7b7127bac757c6bc4df71 (diff) | |
download | gitea-a8e05fdf1b45578ad260aca3d239beb8be6197bf.tar.gz gitea-a8e05fdf1b45578ad260aca3d239beb8be6197bf.zip |
Use toolbox
Diffstat (limited to 'routers/user/home.go')
-rw-r--r-- | routers/user/home.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/routers/user/home.go b/routers/user/home.go index 706c16d91f..177fa38be3 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -119,12 +119,19 @@ func Profile(ctx *middleware.Context) { ctx.Data["Title"] = "Profile" ctx.Data["PageIsUserProfile"] = true - u, err := models.GetUserByName(ctx.Params(":username")) + uname := ctx.Params(":username") + // Special handle for FireFox requests favicon.ico. + if uname == "favicon.ico" { + ctx.Redirect("/img/favicon.png") + return + } + + u, err := models.GetUserByName(uname) if err != nil { if err == models.ErrUserNotExist { - ctx.Handle(404, "user.Profile(GetUserByName)", err) + ctx.Handle(404, "GetUserByName", err) } else { - ctx.Handle(500, "user.Profile(GetUserByName)", err) + ctx.Handle(500, "GetUserByName", err) } return } @@ -146,13 +153,13 @@ func Profile(ctx *middleware.Context) { case "activity": ctx.Data["Feeds"], err = models.GetFeeds(u.Id, 0, true) if err != nil { - ctx.Handle(500, "user.Profile(GetFeeds)", err) + ctx.Handle(500, "GetFeeds", err) return } default: ctx.Data["Repos"], err = models.GetRepositories(u.Id, ctx.IsSigned && ctx.User.Id == u.Id) if err != nil { - ctx.Handle(500, "user.Profile(GetRepositories)", err) + ctx.Handle(500, "GetRepositories", err) return } } |