X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=blobdiff_plain;f=Debbugs%2FLibravatar.pm;h=883305f7a1ded4c9032dca8ba23ce6df11da28a7;hp=0c849431e09a17e4174aab51da0382a73e4a96f6;hb=611036f0b55b809c5c4991ce4e4a6919006ad389;hpb=abb4f72db0baf9bc9fa01664ca4f45b17d47fadf diff --git a/Debbugs/Libravatar.pm b/Debbugs/Libravatar.pm index 0c84943..883305f 100644 --- a/Debbugs/Libravatar.pm +++ b/Debbugs/Libravatar.pm @@ -118,7 +118,18 @@ sub retrieve_libravatar{ $ua->max_size(30*1024); my $r = $ua->get($uri); if (not $r->is_success()) { - die "Not successful in request"; + if ($r->code != 404) { + die "Not successful in request"; + } + # No avatar - cache a negative result + if ($config{libravatar_default_image} =~ m/\.(png|jpg)$/) { + $dest_type = $1; + + system('cp', '-laf', $config{libravatar_default_image}, $cache_location.'.'.$dest_type) == 0 + or die("Cannot copy $config{libravatar_default_image}"); + # Returns from eval {} + return; + } } my $aborted = $r->header('Client-Aborted'); # if we exceeded max size, I'm not sure if we'll be