From bb05ef907b0f19b57d03b035174dbd5fc97af406 Mon Sep 17 00:00:00 2001 From: Martin van Beurden Date: Sun, 28 Sep 2014 14:27:13 +0200 Subject: [PATCH] Fix AvatarLink when using a suburl and gravatar is disabled or avatars are cached --- models/user.go | 4 ++-- modules/base/tool.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/user.go b/models/user.go index 8aa349c8a8..3e2ea82f43 100644 --- a/models/user.go +++ b/models/user.go @@ -97,9 +97,9 @@ func (u *User) HomeLink() string { // AvatarLink returns user gravatar link. func (u *User) AvatarLink() string { if setting.DisableGravatar { - return "/img/avatar_default.jpg" + return setting.AppSubUrl + "/img/avatar_default.jpg" } else if setting.Service.EnableCacheAvatar { - return "/avatar/" + u.Avatar + return setting.AppSubUrl + "/avatar/" + u.Avatar } return "//1.gravatar.com/avatar/" + u.Avatar } diff --git a/modules/base/tool.go b/modules/base/tool.go index eb0ac9e5bf..b4083d090f 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -146,9 +146,9 @@ func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string // AvatarLink returns avatar link by given e-mail. func AvatarLink(email string) string { if setting.DisableGravatar { - return "/img/avatar_default.jpg" + return setting.AppSubUrl + "/img/avatar_default.jpg" } else if setting.Service.EnableCacheAvatar { - return "/avatar/" + EncodeMd5(email) + return setting.AppSubUrl + "/avatar/" + EncodeMd5(email) } return "//1.gravatar.com/avatar/" + EncodeMd5(email) }