rev 1872 - trunk/buscador/lib/Buscador

[prev] [thread] [next] [lurker] [Date index for 2005/02/11]

From: simon
Subject: rev 1872 - trunk/buscador/lib/Buscador
Date: 13:40 on 11 Feb 2005
Author: simon
Date: 2005-02-11 13:40:24 +0000 (Fri, 11 Feb 2005)
New Revision: 1872

Modified:
   trunk/buscador/lib/Buscador/Attachment.pm
Log:
Fix a problem with Base64 encoded attachments


Modified: trunk/buscador/lib/Buscador/Attachment.pm
===================================================================
--- trunk/buscador/lib/Buscador/Attachment.pm	2005-02-10 16:53:47 UTC (rev 1871)
+++ trunk/buscador/lib/Buscador/Attachment.pm	2005-02-11 13:40:24 UTC (rev 1872)
@@ -1,7 +1,6 @@
 package Buscador::Attachment;
 use strict;
 
-
 =head1 NAME
 
 Buscador::Attachment - Buscador plugin to access attachments
@@ -33,15 +32,17 @@
 
 package Email::Store::Attachment;
 use strict;
+use MIME::Base64 qw(decode_base64);
 
+
 sub view :Exported {
     my ($self, $r, $att) = @_;
 
 
-    $r->ar->headers_out->set("Content-Disposition" => "inline; filename=".$att->filename) if $a;
+    $r->ar->headers_out->set("Content-Disposition" => "inline; filename=".$att->filename) if $att->filename;
 
     $r->{content_type} = $att->content_type;
-    $r->{output} = $att->payload;
+    $r->{output} = ($att->content_type =~ m!^text/!) ? $att->payload: decode_base64($att->payload);
 }
 
 1;

Generated at 14:00 on 11 Feb 2005 by mariachi 0.52