mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 10:21:00 +00:00
Fixing the url to gravatar to have hex encoding
This commit is contained in:
parent
59edcd3389
commit
4f9f5673aa
1 changed files with 4 additions and 3 deletions
|
@ -3,17 +3,18 @@ package bitbucketserver
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"bytes"
|
"bytes"
|
||||||
"log"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
|
"encoding/hex"
|
||||||
)
|
)
|
||||||
|
|
||||||
func avatarLink(email string) (url string) {
|
func avatarLink(email string) (url string) {
|
||||||
data := []byte(strings.ToLower(email))
|
hasher := md5.New()
|
||||||
emailHash := md5.Sum(data)
|
hasher.Write([]byte(strings.ToLower(email)))
|
||||||
|
emailHash := fmt.Sprintf("%v", hex.EncodeToString(hasher.Sum(nil)))
|
||||||
avatarURL := fmt.Sprintf("http://www.gravatar.com/avatar/%s.jpg",emailHash)
|
avatarURL := fmt.Sprintf("http://www.gravatar.com/avatar/%s.jpg",emailHash)
|
||||||
log.Info(avatarURL)
|
log.Info(avatarURL)
|
||||||
return avatarURL
|
return avatarURL
|
||||||
|
|
Loading…
Reference in a new issue