]> git.donarmstrong.com Git - debbugs.git/commitdiff
use Debbugs::Libravatar
authorDon Armstrong <don@donarmstrong.com>
Sat, 8 Jun 2013 05:38:38 +0000 (22:38 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sat, 8 Jun 2013 05:38:38 +0000 (22:38 -0700)
fix error call

cgi/libravatar.cgi [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 5fcd834..40a2989
@@ -9,6 +9,7 @@ use Debbugs::Common;
 use Digest::MD5 qw(md5_hex);
 use File::LibMagic;
 use File::Temp qw(tempfile);
+use Debbugs::Libravatar qw(:libravatar);
 
 use Libravatar::URL;
 
@@ -34,7 +35,7 @@ if ($param{avatar} ne 'yes' or not defined $param{email} or not length $param{em
 
 # figure out what the md5sum of the e-mail is.
 my $email_md5sum = md5_hex(lc($param{email}));
-my $cache_location = cache_location($email_md5sum);
+my $cache_location = cache_location(email => lc($param{email}));
 # if we've got it, and it's less than one hour old, return it.
 if (cache_valid($cache_location)) {
     serve_cache($cache_location,$q);
@@ -61,11 +62,11 @@ sub serve_cache {
         $cache_location = $config{libravatar_default_image};
     }
     my $fh = IO::File->new($cache_location,'r') or
-        error(404, "Failed to open cached image $cache_location");
+        error($q,404, "Failed to open cached image $cache_location");
     my $m = File::LibMagic->new() or
-        error(500,'Unable to create File::LibMagic object');
+        error($q,500,'Unable to create File::LibMagic object');
     my $mime_string = $m->checktype_filename($cache_location) or
-        error(500,'Bad file; no mime known');
+        error($q,500,'Bad file; no mime known');
     print $q->header(-type => $mime_string,
                      -expires => '+1d',
                     );
@@ -75,7 +76,7 @@ sub serve_cache {
 
 
 sub error {
-    my ($error,$text) = @_;
+    my ($q,$error,$text) = @_;
     $text //= '';
     print $q->header(-status => $error);
     print "<h2>$error: $text</h2>";