]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/comments.pm
check site url for https
[ikiwiki.git] / IkiWiki / Plugin / comments.pm
index df20e7b966434701b32800c232b000e7826dc20c..cb0196728ef5652573df7d53a9ae509c4723877a 100755 (executable)
@@ -189,13 +189,20 @@ sub preprocess {
                        $commentauthor = $commentuser;
                }
 
-               eval 'use Libravatar::URL';
+               eval q{use Libravatar::URL};
                if (! $@) {
+                       my $https=defined $config{url} && $config{url}=~/^https:/;
+
                        if (defined $commentopenid) {
-                               $commentauthoravatar = libravatar_url(openid => $commentopenid, https => $ENV{HTTPS});
+                               eval {
+                                       $commentauthoravatar = libravatar_url(openid => $commentopenid, https => $https);
+                               }
                        }
-                       elsif (my $email = IkiWiki::userinfo_get($commentuser, 'email')) {
-                               $commentauthoravatar = libravatar_url(email => $email, https => $ENV{HTTPS});
+                       if (! defined $commentauthoravatar &&
+                           (my $email = IkiWiki::userinfo_get($commentuser, 'email'))) {
+                               eval {
+                                       $commentauthoravatar = libravatar_url(email => $email, https => $https);
+                               }
                        }
                }
        }