Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix: use lowercase email for gravatar (#527)

Guilherme Oenning7007d99ae693
diff --git a/app/handlers/images.go b/app/handlers/images.go
index ffc0be047..89e7ae417 100644
--- a/app/handlers/images.go
+++ b/app/handlers/images.go
@@ -27,7 +27,7 @@ func Avatar() web.HandlerFunc {
user, err := c.Services().Users.GetByID(id)
if err == nil && user.Tenant.ID == c.Tenant().ID {
if user.Email != "" {
- url := fmt.Sprintf("https://www.gravatar.com/avatar/%s?s=%d&d=404", md5.Hash(user.Email), size)
+ url := fmt.Sprintf("https://www.gravatar.com/avatar/%s?s=%d&d=404", md5.Hash(strings.ToLower(user.Email)), size)
c.Logger().Debugf("Requesting gravatar: @{GravatarURL}", log.Props{
"GravatarURL": url,
})
diff --git a/app/handlers/images_test.go b/app/handlers/images_test.go
index e5a89706d..8cddba7ce 100644
--- a/app/handlers/images_test.go
+++ b/app/handlers/images_test.go
@@ -18,7 +18,7 @@ func TestGravatarHandler(t *testing.T) {
server, services := mock.NewServer()
user := &models.User{
Name: "Darth Vader",
- Email: "[email protected]",
+ Email: "[email protected]",
Tenant: mock.DemoTenant,
}
services.Users.Register(user)