[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-225-g6b12b8f
Ruslan Zakirov
ruz at bestpractical.com
Fri Oct 22 21:25:50 EDT 2010
The branch, 3.9-trunk has been updated
via 6b12b8fe6726210a3c3a50cb9e91b9ee331eb157 (commit)
from 140c26c3d9c9912658a61f6627f551c045a10d2b (commit)
Summary of changes:
lib/RT/Attachment_Overlay.pm | 7 ++++---
lib/RT/Record.pm | 6 ++++--
2 files changed, 8 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit 6b12b8fe6726210a3c3a50cb9e91b9ee331eb157
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sat Oct 23 02:23:25 2010 +0400
If we drop attachment replace it with plain/text one
Adobe Reader and other apps may be very upset with
file containing plain text instead of special format.
Thanks to Mikal Gule
diff --git a/lib/RT/Attachment_Overlay.pm b/lib/RT/Attachment_Overlay.pm
index 008e33e..9b25357 100644
--- a/lib/RT/Attachment_Overlay.pm
+++ b/lib/RT/Attachment_Overlay.pm
@@ -173,14 +173,15 @@ sub Create {
#If it's not multipart
else {
- my ($ContentEncoding, $Body) = $self->_EncodeLOB(
+ my ($ContentEncoding, $Body, $ContentType, $Filename) = $self->_EncodeLOB(
$Attachment->bodyhandle->as_string,
- $Attachment->mime_type
+ $Attachment->mime_type,
+ $Filename
);
my $id = $self->SUPER::Create(
TransactionId => $args{'TransactionId'},
- ContentType => $Attachment->mime_type,
+ ContentType => $ContentType,
ContentEncoding => $ContentEncoding,
Parent => $args{'Parent'},
Headers => $head,
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 6642546..8ff462e 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -709,6 +709,7 @@ sub _EncodeLOB {
my $self = shift;
my $Body = shift;
my $MIMEType = shift;
+ my $Filename = shift;
my $ContentEncoding = 'none';
@@ -752,7 +753,8 @@ sub _EncodeLOB {
$RT::Logger->info( "$self: Dropped an attachment of size "
. length($Body));
$RT::Logger->info( "It started: " . substr( $Body, 0, 60 ) );
- return ("none", "Large attachment dropped" );
+ $Filename .= ".txt" if $Filename;
+ return ("none", "Large attachment dropped", "plain/text", $Filename );
}
}
@@ -769,7 +771,7 @@ sub _EncodeLOB {
}
- return ($ContentEncoding, $Body);
+ return ($ContentEncoding, $Body, $MIMEType, $Filename );
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list