summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro Santilli <strk@kbt.io>2016-07-16 02:19:30 +0200
committer无闻 <u@gogs.io>2016-07-16 08:19:30 +0800
commita4ea3bd01519a3c7dc3c4cd135c5594c14955046 (patch)
tree2daacd14150b0e413abf7ebd5e2d6eb3a5885239
parent3d93532c87823159dd03e9c64a58c7bafed0fa64 (diff)
downloadgitea-a4ea3bd01519a3c7dc3c4cd135c5594c14955046.tar.gz
gitea-a4ea3bd01519a3c7dc3c4cd135c5594c14955046.zip
Return avatar link as absolute url (#3235)
Fixes relative urls coming from api/v1 See https://github.com/drone/drone/issues/1701
-rw-r--r--models/user.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go
index f4c5b669c2..20b122d779 100644
--- a/models/user.go
+++ b/models/user.go
@@ -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
}