0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-23 15:53:07 -05:00

Return avatar link as absolute url (#3235)

Fixes relative urls coming from api/v1

See https://github.com/drone/drone/issues/1701
This commit is contained in:
Sandro Santilli 2016-07-16 02:19:30 +02:00 committed by 无闻
parent 3d93532c87
commit a4ea3bd015

View file

@ -263,11 +263,11 @@ func (u *User) RelAvatarLink() string {
return setting.GravatarSource + u.Avatar
}
// AvatarLink returns user gravatar link.
// AvatarLink returns user avatar link.
func (u *User) AvatarLink() string {
link := u.RelAvatarLink()
if link[0] == '/' && link[1] != '/' {
return setting.AppSubUrl + link
return strings.TrimSuffix(setting.AppUrl, "/") + link
}
return link
}