[rt-users] Patch for RT 3.0.3 attachment conversion problem
Remy Chibois
rchibois at free.fr
Wed Jun 25 09:55:49 EDT 2003
Quoting Dirk Pape <pape-rt at inf.fu-berlin.de>:
Hello,
> we also have this problem here. I already send a (personal) bug report
> to
> Jesse with some attachments demonstrating this. I thought it only
> affected
> this special attachments.
The following patch seems to correct the problem and works for my setup.
Can you please give it a try ?
(I'm sorry to copy it in the message body but this damn webmail does not handle
attachments very well)
SNIP ---- 8< ---- 8< ---- SNIP
--- lib/RT/I18N.pm.orig Wed Jun 25 15:40:44 2003
+++ lib/RT/I18N.pm Wed Jun 25 15:35:22 2003
@@ -161,6 +161,16 @@
SetMIMEEntityToEncoding( $_, $enc ) foreach $entity->parts;
}
+ if ($entity->head->mime_type !~ /^text\/plain$/) {
+ # convert at least MIME word encoded attachment filename
+ foreach my $attr (qw(content-type.name content-disposition.filename)) {
+ if (my $name = $entity->head->mime_attr($attr)) {
+ $entity->head->mime_attr($attr => DecodeMIMEWordsToUTF8($name));
+ }
+ }
+ return;
+ }
+
my $charset = _FindOrGuessCharset($entity) or return;
# one and only normalization
$charset = 'utf-8' if $charset eq 'utf8';
@@ -169,16 +179,6 @@
SetMIMEHeadToEncoding($entity->head, $charset => $enc);
my $head = $entity->head;
-
- # convert at least MIME word encoded attachment filename
- foreach my $attr (qw(content-type.name content-disposition.filename)) {
- if ( my $name = $head->mime_attr($attr) ) {
- $head->mime_attr( $attr => DecodeMIMEWordsToUTF8($name) );
- }
- }
-
- return unless ( $head->mime_type =~ /^text\/plain$/i );
-
my $body = $entity->bodyhandle;
if ( $enc ne $charset ) {
SNIP ---- 8< ---- 8< ---- SNIP
--
Remy Chibois
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rt-3.0.3-I18N-Attachments.patch
Type: application/octet-stream
Size: 0 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20030625/9b0dc73c/attachment.obj>
More information about the rt-users
mailing list