Browse Source

fix cannot show user public ssh keys

pull/2370/head
Unknwon 9 years ago
parent
commit
62edc5c59a
  1. 12
      routers/user/profile.go

12
routers/user/profile.go

@ -21,9 +21,8 @@ const (
STARS base.TplName = "user/meta/stars" STARS base.TplName = "user/meta/stars"
) )
// GetUserByParams returns user whose name is presented in URL paramenter. func GetUserByName(ctx *middleware.Context, name string) *models.User {
func GetUserByParams(ctx *middleware.Context) *models.User { user, err := models.GetUserByName(name)
user, err := models.GetUserByName(ctx.Params(":username"))
if err != nil { if err != nil {
if models.IsErrUserNotExist(err) { if models.IsErrUserNotExist(err) {
ctx.Error(404) ctx.Error(404)
@ -35,6 +34,11 @@ func GetUserByParams(ctx *middleware.Context) *models.User {
return 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) { func Profile(ctx *middleware.Context) {
uname := ctx.Params(":username") uname := ctx.Params(":username")
// Special handle for FireFox requests favicon.ico. // Special handle for FireFox requests favicon.ico.
@ -51,7 +55,7 @@ func Profile(ctx *middleware.Context) {
isShowKeys = true isShowKeys = true
} }
u := GetUserByParams(ctx) u := GetUserByName(ctx, strings.TrimSuffix(uname, ".keys"))
if ctx.Written() { if ctx.Written() {
return return
} }

Loading…
Cancel
Save