+if ( RT->Config->Get('AlwaysDownloadAttachments') ) {
+ $r->headers_out->{'Content-Disposition'} = "attachment";
+}
+elsif ( !RT->Config->Get('TrustHTMLAttachments') ) {
+ $content_type = 'text/plain' if ( $content_type =~ /^text\/html/i );
+}
+elsif (lc $content_type eq 'text/html') {
+ # If we're trusting and serving HTML for display not download, try to do
+ # inline <img> rewriting to be extra helpful.
+ my $count = RT::Interface::Web::RewriteInlineImages(
+ Content => \$content,
+ Attachment => $AttachmentObj,
+ );
+ RT->Logger->debug("Rewrote $count CID images when displaying original HTML attachment #$attach");
+}