mirror of https://gitee.com/answerdev/answer.git
fix: set gravatar size parameter is s
This commit is contained in:
parent
97ab26663f
commit
5a16859e6b
|
@ -28,7 +28,7 @@ func Resize(originalAvatarURL string, sizePixel int) (resizedAvatarURL string) {
|
|||
return originalAvatarURL
|
||||
}
|
||||
query := originalURL.Query()
|
||||
query.Set("p", fmt.Sprintf("%d", sizePixel))
|
||||
query.Set("s", fmt.Sprintf("%d", sizePixel))
|
||||
originalURL.RawQuery = query.Encode()
|
||||
return originalURL.String()
|
||||
}
|
||||
|
|
|
@ -44,15 +44,15 @@ func TestResize(t *testing.T) {
|
|||
originalAvatarURL: "https://www.gravatar.com/avatar/b2be4e4438f08a5e885be8de5f41fdd7",
|
||||
sizePixel: 128,
|
||||
},
|
||||
wantResizedAvatarURL: "https://www.gravatar.com/avatar/b2be4e4438f08a5e885be8de5f41fdd7?p=128",
|
||||
wantResizedAvatarURL: "https://www.gravatar.com/avatar/b2be4e4438f08a5e885be8de5f41fdd7?s=128",
|
||||
},
|
||||
{
|
||||
name: "already resized url",
|
||||
args: args{
|
||||
originalAvatarURL: "https://www.gravatar.com/avatar/b2be4e4438f08a5e885be8de5f41fdd7?p=128",
|
||||
originalAvatarURL: "https://www.gravatar.com/avatar/b2be4e4438f08a5e885be8de5f41fdd7?s=128",
|
||||
sizePixel: 64,
|
||||
},
|
||||
wantResizedAvatarURL: "https://www.gravatar.com/avatar/b2be4e4438f08a5e885be8de5f41fdd7?p=64",
|
||||
wantResizedAvatarURL: "https://www.gravatar.com/avatar/b2be4e4438f08a5e885be8de5f41fdd7?s=64",
|
||||
},
|
||||
{
|
||||
name: "empty url",
|
||||
|
|
Loading…
Reference in New Issue