mirror of https://github.com/go-gitea/gitea.git
fix cannot show user public ssh keys
parent
cc8c67ff29
commit
62edc5c59a
|
@ -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…
Reference in New Issue