diff options
author | dakkar <dakkar@luxion> | 2005-11-09 20:14:46 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-11-09 20:14:46 +0000 |
commit | b9108b0bc2b63e83e6a79063ef0749581edf557c (patch) | |
tree | 031f53418e2d9263a555a0af91755c0571a933f2 /lib/Bookmarks/Utils.pm | |
parent | * passati i template a HTML4, altrimenti l'autocompletamento non va (diff) | |
download | Bookmarks-b9108b0bc2b63e83e6a79063ef0749581edf557c.tar.gz Bookmarks-b9108b0bc2b63e83e6a79063ef0749581edf557c.tar.bz2 Bookmarks-b9108b0bc2b63e83e6a79063ef0749581edf557c.zip |
aggiunta l'icona di default, e corretto il codice icone in generale
Diffstat (limited to 'lib/Bookmarks/Utils.pm')
-rw-r--r-- | lib/Bookmarks/Utils.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Bookmarks/Utils.pm b/lib/Bookmarks/Utils.pm index a876340..b9fec9c 100644 --- a/lib/Bookmarks/Utils.pm +++ b/lib/Bookmarks/Utils.pm @@ -20,7 +20,9 @@ sub get_site_icon { return if $url!~/^http:/; print "Provo nella pagina\n"; - my $page=get($url); + my $res=$ua->get($url); + return unless $res->is_success(); + my $page=$res->decoded_content(); my ($favicon)= grep {defined $_ and $_ ne ''} ($page =~ m{<link @@ -40,9 +42,9 @@ sub get_site_icon { print "Trovato: '$favicon'"; $favicon=URI::URL->new($favicon,$url)->abs->canonical->as_string; print ", ovvero '$favicon'\n"; - my $res=$ua->get($favicon); + $res=$ua->get($favicon); - if ($res->is_success()) { + if ($res->is_success() and $res->header('Content-type') !~ /^text/) { return ($res->decoded_content(),$res->header('Content-type')); } else { |