robustness fix

Don't fail if libravatar fails for some reason. Reasons I can think
of:

* too old version to do openid lookups (fall back to email lookup)
* network problem perhaps
master
Joey Hess 2011-03-30 10:54:24 -04:00
parent c8cf2d1ed7
commit f4262696ad
1 changed files with 9 additions and 4 deletions

View File

@ -189,16 +189,21 @@ sub preprocess {
$commentauthor = $commentuser;
}
eval 'use Libravatar::URL';
eval q{use Libravatar::URL};
if (! $@) {
if (defined $commentopenid) {
eval {
$commentauthoravatar = libravatar_url(openid => $commentopenid, https => $ENV{HTTPS});
}
elsif (my $email = IkiWiki::userinfo_get($commentuser, 'email')) {
}
if (! defined $commentauthoravatar &&
(my $email = IkiWiki::userinfo_get($commentuser, 'email'))) {
eval {
$commentauthoravatar = libravatar_url(email => $email, https => $ENV{HTTPS});
}
}
}
}
else {
if (defined $params{ip}) {
$commentip = $params{ip};