use https for fetch gravatar by default (#20964)

pull/20989/head
Jiajun Huang 6 years ago committed by Arve Knudsen
parent 1a2dad9d0c
commit 5e34e061d5
  1. 18
      pkg/api/avatar/avatar.go

@ -27,19 +27,9 @@ import (
gocache "github.com/patrickmn/go-cache"
)
var gravatarSource string
func UpdateGravatarSource() {
srcCfg := "//secure.gravatar.com/avatar/"
gravatarSource = srcCfg
if strings.HasPrefix(gravatarSource, "//") {
gravatarSource = "http:" + gravatarSource
} else if !strings.HasPrefix(gravatarSource, "http://") &&
!strings.HasPrefix(gravatarSource, "https://") {
gravatarSource = "http://" + gravatarSource
}
}
const (
gravatarSource = "https://secure.gravatar.com/avatar/"
)
// Avatar represents the avatar object.
type Avatar struct {
@ -126,8 +116,6 @@ func (this *CacheServer) Handler(ctx *macaron.Context) {
}
func NewCacheServer() *CacheServer {
UpdateGravatarSource()
return &CacheServer{
notFound: newNotFound(),
cache: gocache.New(time.Hour, time.Hour*2),

Loading…
Cancel
Save