mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-31 06:11:56 +08:00
Fix: email address should be lowercase for requesting Gravatar (#758)
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
model "github.com/cloudreve/Cloudreve/v3/models"
|
model "github.com/cloudreve/Cloudreve/v3/models"
|
||||||
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
|
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
|
||||||
@@ -200,8 +201,8 @@ func (service *AvatarService) Get(c *gin.Context) serializer.Response {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return serializer.Err(serializer.CodeInternalSetting, "无法解析 Gravatar 服务器地址", err)
|
return serializer.Err(serializer.CodeInternalSetting, "无法解析 Gravatar 服务器地址", err)
|
||||||
}
|
}
|
||||||
|
email_lowered := strings.ToLower(user.Email)
|
||||||
has := md5.Sum([]byte(user.Email))
|
has := md5.Sum([]byte(email_lowered))
|
||||||
avatar, _ := url.Parse(fmt.Sprintf("/avatar/%x?d=mm&s=%s", has, sizes[service.Size]))
|
avatar, _ := url.Parse(fmt.Sprintf("/avatar/%x?d=mm&s=%s", has, sizes[service.Size]))
|
||||||
|
|
||||||
return serializer.Response{
|
return serializer.Response{
|
||||||
|
|||||||
Reference in New Issue
Block a user