summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-01-20 13:38:17 +0800
committer无闻 <u@gogs.io>2015-01-20 13:38:17 +0800
commit830bc751070b0fd62ba9b01f864cdb41d9f46078 (patch)
treef681601f9144f75e76767b04a5509894b2a55fc9 /modules
parent8e384ce46c69b0e90168094f64e2ad6c787f4cbb (diff)
parentcf59057ef3e91735592a3067ba803c9223a64caa (diff)
downloadgitea-830bc751070b0fd62ba9b01f864cdb41d9f46078.tar.gz
gitea-830bc751070b0fd62ba9b01f864cdb41d9f46078.zip
Merge pull request #866 from vitalvas/dev
Fix in url if cache avatar is enabled
Diffstat (limited to 'modules')
-rw-r--r--modules/avatar/avatar.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go
index c0a71f11de..73daa213c9 100644
--- a/modules/avatar/avatar.go
+++ b/modules/avatar/avatar.go
@@ -38,10 +38,12 @@ import (
var gravatarSource string
-func init() {
+func UpdateGravatarSource() {
gravatarSource = setting.GravatarSource
+ log.Debug("avatar.UpdateGravatarSource(gavatar source): %s", gravatarSource)
if !strings.HasPrefix(gravatarSource, "http:") {
gravatarSource = "http:" + gravatarSource
+ log.Debug("avatar.UpdateGravatarSource(update gavatar source): %s", gravatarSource)
}
}
@@ -131,11 +133,13 @@ func (this *Avatar) Encode(wr io.Writer, size int) (err error) {
// get image from gravatar.com
func (this *Avatar) Update() {
+ UpdateGravatarSource()
thunder.Fetch(gravatarSource+this.Hash+"?"+this.reqParams,
this.imagePath)
}
func (this *Avatar) UpdateTimeout(timeout time.Duration) (err error) {
+ UpdateGravatarSource()
select {
case <-time.After(timeout):
err = fmt.Errorf("get gravatar image %s timeout", this.Hash)