Thread (29 messages) flat view 29 messages, 2 authors, 2016-06-15

[PATCHv7 8/9] gitweb: use picon for gravatar fallback

From: Giuseppe Bilotta <hidden>
Date: 2016-06-15 22:46:59
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Giuseppe Bilotta <redacted>
---
 gitweb/gitweb.perl |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ae73d45..e2638cb 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1546,9 +1546,13 @@ sub picon_url {
 sub gravatar_url {
 	my $email = lc shift;
 	my $size = shift;
-	$avatar_cache{$email} ||=
-		"http://www.gravatar.com/avatar.php?gravatar_id=" .
-			Digest::MD5::md5_hex($email) . "&amp;size=";
+	if (!$avatar_cache{$email}) {
+		my $picon = CGI::escape(picon_url($email));
+		$avatar_cache{$email} = "http://www.gravatar.com/avatar.php?gravatar_id=" .
+			Digest::MD5::md5_hex($email) .
+			"&amp;default=$picon" .
+			"&amp;size=";
+	}
 	return $avatar_cache{$email} . $size;
 }
 
-- 
1.6.3.rc1.192.gdbfcb
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help