diff options
author | Unknwon <u@gogs.io> | 2016-01-09 13:28:05 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-01-09 13:28:05 +0800 |
commit | 62edc5c59a3c85f22afd97aa888b4cff26a10d02 (patch) | |
tree | eb530f31fb90ed0ace47fdc052d3bf1c4c34f02a /routers/user/profile.go | |
parent | cc8c67ff29f85630c6e79cc9ea9e55b68a1a6805 (diff) | |
download | gitea-62edc5c59a3c85f22afd97aa888b4cff26a10d02.tar.gz gitea-62edc5c59a3c85f22afd97aa888b4cff26a10d02.zip |
fix cannot show user public ssh keys
Diffstat (limited to 'routers/user/profile.go')
-rw-r--r-- | routers/user/profile.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go index 9007ab326f..915cf86c61 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -21,9 +21,8 @@ const ( STARS base.TplName = "user/meta/stars" ) -// GetUserByParams returns user whose name is presented in URL paramenter. -func GetUserByParams(ctx *middleware.Context) *models.User { - user, err := models.GetUserByName(ctx.Params(":username")) +func GetUserByName(ctx *middleware.Context, name string) *models.User { + user, err := models.GetUserByName(name) if err != nil { if models.IsErrUserNotExist(err) { ctx.Error(404) @@ -35,6 +34,11 @@ func GetUserByParams(ctx *middleware.Context) *models.User { return user } +// GetUserByParams returns user whose name is presented in URL paramenter. +func GetUserByParams(ctx *middleware.Context) *models.User { + return GetUserByName(ctx, ctx.Params(":username")) +} + func Profile(ctx *middleware.Context) { uname := ctx.Params(":username") // Special handle for FireFox requests favicon.ico. @@ -51,7 +55,7 @@ func Profile(ctx *middleware.Context) { isShowKeys = true } - u := GetUserByParams(ctx) + u := GetUserByName(ctx, strings.TrimSuffix(uname, ".keys")) if ctx.Written() { return } |