Skip to content

Commit

Permalink
fix: Fix a bug with URL check for avatars
Browse files Browse the repository at this point in the history
Fixes a bug introduced in #2947
  • Loading branch information
gchtr committed May 15, 2024
1 parent 05af54f commit af56003
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ protected function avatar_default($default, $email, $size, $host)
$default = $avatar_default;
}
}

if ('mystery' == $default) {
$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
// ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
Expand All @@ -597,7 +598,7 @@ protected function avatar_default($default, $email, $size, $host)
$default = '';
} elseif ('gravatar_default' == $default) {
$default = $host . '/avatar/?s=' . $size;
} elseif (empty($email) && !\strstr($default, 'https://')) {
} elseif (empty($email) && !\preg_match('/^https?:\/\//', $default)) {
$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
}
return $default;
Expand Down

0 comments on commit af56003

Please sign in to comment.