[rt-users] Official Attachment Status
Autrijus Tang
autrijus at autrijus.org
Thu May 15 08:26:02 EDT 2003
On Wed, May 14, 2003 at 10:14:55AM -0400, Art Morales wrote:
> Hello,
>
> After reading through the archives, I'm not entirely clear if
> attachments are supposed to be working in the latest version (3.0.2).
> Mine aren't, so before I dig down to figure out what I did wrong, I was
> wondering if we could get the official word. I'm running RH8,
> apache2/modperl1.99 (everything else works great)
Unicode-characters in WebUI's "file attachments" has been fixed
here by the change below. Hadn't tested it with the mail-gateway,
though.
Thanks,
/Autrijus/
Change 5860 by autrijus at ehrtest on 2003/05/15 12:00:25
* utf8 filenames in attachments is now ok.
* no longer attempts to convert web-attached textual parts into utf8, only the body.
Affected files ...
... //depot/RT/rt/lib/RT/Attachment_Overlay.pm#18 edit
... //depot/RT/rt/lib/RT/Interface/Web.pm#50 edit
Differences ...
==== //depot/RT/rt/lib/RT/Attachment_Overlay.pm#18 (text) ====
@@ -136,7 +136,10 @@
chomp($Subject);
#Get the filename
- my $Filename = $Attachment->head->recommended_filename;
+ my $Filename = $Attachment->head->recommended_filename || eval {
+ ${ $Attachment->head->{mail_hdr_hash}{'Content-Disposition'}[0] }
+ =~ /^.*\bfilename="(.*)"$/ ? $1 : ''
+ };
if ( $Attachment->parts ) {
$id = $self->SUPER::Create(
==== //depot/RT/rt/lib/RT/Interface/Web.pm#50 (text) ====
@@ -453,6 +453,8 @@
);
}
+ RT::I18N::SetMIMEEntityToUTF8($Message); # convert text parts into utf-8
+
my $cgi_object = $m->cgi_object;
if (my $filehandle = $cgi_object->upload( $args{'AttachmentFieldName'} ) ) {
@@ -478,10 +480,11 @@
$filename = "$filehandle" unless defined($filename);
$filename =~ s#^.*[\\/]##;
+
$Message->attach(
Path => $temp_file,
- Filename => $filename,
- Type => $uploadinfo->{'Content-Type'}
+ Filename => Encode::decode_utf8($filename),
+ Type => $uploadinfo->{'Content-Type'},
);
close($fh);
@@ -490,7 +493,6 @@
}
$Message->make_singlepart();
- RT::I18N::SetMIMEEntityToUTF8($Message); # convert text parts into utf-8
return ($Message);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20030515/e19fa3e4/attachment.sig>
More information about the rt-users
mailing list