Skip to content

Commit a7e914b

Browse files
committed
Remove extension from URL to avoid to load the same image content
1 parent 60cf5ea commit a7e914b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Gravatar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Gravatar extends Base
1616
'wavatar',
1717
];
1818

19-
private const URL = 'https://www.gravatar.com/avatar/%s.jpg?d=%s&size=%d';
19+
private const URL = 'https://www.gravatar.com/avatar/%s?d=%s&size=%d';
2020

2121
public static function gravatarUrl(string $mode = null, string $email = null, int $size = 80): string
2222
{

tests/GravatarTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ class GravatarTest extends TestCase
99
{
1010
public function testDefaultUrlValues()
1111
{
12-
$this->assertRegExp('#^https://www\.gravatar\.com/avatar/\d+\.jpg\?d=retro&size=80#', Gravatar::gravatarUrl());
12+
$this->assertRegExp('#^https://www\.gravatar\.com/avatar/\d+\?d=retro&size=80#', Gravatar::gravatarUrl());
1313
}
1414

1515
public function testGravatarUrlAcceptsCustomMode()
1616
{
17-
$this->assertRegExp('#^https://www\.gravatar\.com/avatar/\d+\.jpg\?d=mp&size=80#', Gravatar::gravatarUrl('mp'));
17+
$this->assertRegExp('#^https://www\.gravatar\.com/avatar/\d+\?d=mp&size=80#', Gravatar::gravatarUrl('mp'));
1818
}
1919

2020
public function testGravatarUrlAcceptsCustomSize()
2121
{
22-
$this->assertRegExp('#^https://www\.gravatar\.com/avatar/\d+\.jpg\?d=retro&size=200#', Gravatar::gravatarUrl(null, null, 200));
22+
$this->assertRegExp('#^https://www\.gravatar\.com/avatar/\d+\?d=retro&size=200#', Gravatar::gravatarUrl(null, null, 200));
2323
}
2424

2525
public function testGravatarUrlAcceptsCustomEmail()
2626
{
2727
$email = 'TeSt@EmAiL.OK';
2828
$hash = md5(strtolower($email));
2929

30-
$this->assertRegExp("#^https://www\.gravatar\.com/avatar/${hash}\.jpg\?d=retro&size=80#", Gravatar::gravatarUrl(null, $email));
30+
$this->assertRegExp("#^https://www\.gravatar\.com/avatar/${hash}\?d=retro&size=80#", Gravatar::gravatarUrl(null, $email));
3131
}
3232

3333
public function testDownloadWithDefaults()

0 commit comments

Comments
 (0)