1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-22 08:42:32 -05:00

fix cannot show user public ssh keys

This commit is contained in:
Unknwon 2016-01-09 13:28:05 +08:00
parent cc8c67ff29
commit 62edc5c59a

View file

@ -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
} }