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 (
|
||||
"net/http"
|
||||
"bytes"
|
||||
"log"
|
||||
"io/ioutil"
|
||||
"fmt"
|
||||
"strings"
|
||||
"crypto/md5"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func avatarLink(email string) (url string) {
|
||||
data := []byte(strings.ToLower(email))
|
||||
emailHash := md5.Sum(data)
|
||||
hasher := md5.New()
|
||||
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)
|
||||
log.Info(avatarURL)
|
||||
return avatarURL
|
||||
|
|
Loading…
Reference in a new issue