Browse Source

Return avatar link as absolute url (#3235)

Fixes relative urls coming from api/v1

See https://github.com/drone/drone/issues/1701
pull/2793/merge
Sandro Santilli 8 years ago committed by 无闻
parent
commit
a4ea3bd015
  1. 4
      models/user.go

4
models/user.go

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

Loading…
Cancel
Save