]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/comments.pm
robustness fix
[ikiwiki.git] / IkiWiki / Plugin / comments.pm
index 00ab1c8bdacda84e0ee12279074e14110e0f26d3..fcce6c5a6d131193a2a3b2932dc5a3b5778b0b66 100755 (executable)
@@ -189,15 +189,20 @@ sub preprocess {
                        $commentauthor = $commentuser;
                }
 
-                eval 'use Libravatar::URL';
-
-                if (! $@) {
-                    my $email = IkiWiki::userinfo_get($commentuser, 'email');
-
-                    if (defined $email) {
-                        $commentauthoravatar = libravatar_url(email => $email);
-                    }
-                }
+               eval q{use Libravatar::URL};
+               if (! $@) {
+                       if (defined $commentopenid) {
+                               eval {
+                                       $commentauthoravatar = libravatar_url(openid => $commentopenid, https => $ENV{HTTPS});
+                               }
+                       }
+                       if (! defined $commentauthoravatar &&
+                           (my $email = IkiWiki::userinfo_get($commentuser, 'email'))) {
+                               eval {
+                                       $commentauthoravatar = libravatar_url(email => $email, https => $ENV{HTTPS});
+                               }
+                       }
+               }
        }
        else {
                if (defined $params{ip}) {
@@ -228,7 +233,7 @@ sub preprocess {
                        my $url=$params{url};
 
                        eval q{use URI::Heuristic}; 
-                       if (! $@) {
+                       if (! $@) {
                                $url=URI::Heuristic::uf_uristr($url);
                        }