diff options
author | dakkar <dakkar@luxion> | 2005-11-11 11:38:54 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-11-11 11:38:54 +0000 |
commit | b1a91d8a59cc27623989d5d79643fb167c6d0aa9 (patch) | |
tree | c47199a917975f051fba3b5d952ea6e4530ff6a6 /lib | |
parent | tolte delle print inutili (e dannose sotto mod_perl) (diff) | |
download | Bookmarks-b1a91d8a59cc27623989d5d79643fb167c6d0aa9.tar.gz Bookmarks-b1a91d8a59cc27623989d5d79643fb167c6d0aa9.tar.bz2 Bookmarks-b1a91d8a59cc27623989d5d79643fb167c6d0aa9.zip |
work-around per tipi icone mal dichiarati: se non dichiarata come un'immagine, รจ un image/x-icon (ugh)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Bookmarks/C/Main.pm | 4 | ||||
-rw-r--r-- | lib/Bookmarks/M/DB/Links.pm | 18 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lib/Bookmarks/C/Main.pm b/lib/Bookmarks/C/Main.pm index 83edfa9..be50a73 100644 --- a/lib/Bookmarks/C/Main.pm +++ b/lib/Bookmarks/C/Main.pm @@ -61,9 +61,9 @@ sub icon : Global { my ( $self, $c ) = @_; my $link=Bookmarks::M::DB::Links->retrieve($c->req->param('link')); - my $icon=$link->get_icon(); + my ($icon,$type)=$link->get_icon(); if ($icon) { - $c->res->content_type($link->icon_type()); + $c->res->content_type($type); $c->res->body($icon); } else { diff --git a/lib/Bookmarks/M/DB/Links.pm b/lib/Bookmarks/M/DB/Links.pm index 5103522..ebfa963 100644 --- a/lib/Bookmarks/M/DB/Links.pm +++ b/lib/Bookmarks/M/DB/Links.pm @@ -12,12 +12,26 @@ for my $col_name (qw(add_date last_access_date)) { } sub set_icon { - my ($self,$icon)=@_; + my ($self,$icon,$type)=@_; + $self->icon(encode_base64($icon||'')); + $type||=''; + if ($type !~ m{^image/}) { + $type='image/x-icon'; + } + $self->icon_type($type); + + return; } sub get_icon { my ($self)=@_; - return decode_base64($self->icon()||''); + + my $type=$self->icon_type()||''; + if ($type !~ m{^image/}) { + $type='image/x-icon'; + } + + return (decode_base64($self->icon()||''),$type); } sub search_complex { |