feat: gravatar - Lowercase emails before MD5 hash (#10)
This commit is contained in:
parent
efd0970971
commit
36bf3d216a
1 changed files with 2 additions and 1 deletions
|
@ -21,6 +21,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.vikunja.io/api/pkg/config"
|
"code.vikunja.io/api/pkg/config"
|
||||||
|
@ -64,7 +65,7 @@ func (g *Provider) GetAvatar(user *user.User, size int64) ([]byte, string, error
|
||||||
}
|
}
|
||||||
if !exists || needsRefetch {
|
if !exists || needsRefetch {
|
||||||
log.Debugf("Gravatar for user %d with size %d not cached, requesting from gravatar...", user.ID, size)
|
log.Debugf("Gravatar for user %d with size %d not cached, requesting from gravatar...", user.ID, size)
|
||||||
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "https://www.gravatar.com/avatar/"+utils.Md5String(user.Email)+"?s="+sizeString+"&d=mp", nil)
|
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "https://www.gravatar.com/avatar/"+utils.Md5String(strings.ToLower(user.Email))+"?s="+sizeString+"&d=mp", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue