[Rt-commit] rt branch, 4.0/default-attachment-disposition, created. rt-4.0.13-91-g2ce3591
Thomas Sibley
trs at bestpractical.com
Thu Jun 27 16:20:02 EDT 2013
The branch, 4.0/default-attachment-disposition has been created
at 2ce3591425072e391bc809b177e02e4d721a6f12 (commit)
- Log -----------------------------------------------------------------
commit 2ce3591425072e391bc809b177e02e4d721a6f12
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Jun 27 13:11:30 2013 -0700
Default to the "attachment" disposition when none is specified
Attachments received to RT via email usually have a Content-disposition
header, which we continue to respect.
However, attachments uploaded via the web will not and rely on the
default here in AddAttachment(). Previously we relied on MIME::Entity's
default, but it is not appropriate to assume all files are inline-able.
Indeed, common sense dictates that attachments be treated as
attachments, which is in line with user expectations. Lenient MUAs
which don't always respect the inline disposition have kept us from
noticing when RT sends mail demanding PDFs, sound files, and other
binaries are inlined.
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index ab0f307..f1c54dd 100644
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -397,14 +397,15 @@ sub AddAttachment {
and $attach->TransactionObj->CurrentUserCanSee;
# ->attach expects just the disposition type; extract it if we have the header
+ # or default to "attachment"
my $disp = ($attach->GetHeader('Content-Disposition') || '')
- =~ /^\s*(inline|attachment)/i ? $1 : undef;
+ =~ /^\s*(inline|attachment)/i ? $1 : "attachment";
$MIMEObj->attach(
Type => $attach->ContentType,
Charset => $attach->OriginalEncoding,
Data => $attach->OriginalContent,
- Disposition => $disp, # a false value defaults to inline in MIME::Entity
+ Disposition => $disp,
Filename => $self->MIMEEncodeString( $attach->Filename ),
'RT-Attachment:' => $self->TicketObj->Id . "/"
. $self->TransactionObj->Id . "/"
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list