[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-124-gdde5b99

sartak at bestpractical.com sartak at bestpractical.com
Mon Feb 1 18:48:24 EST 2010


The branch, 3.8-trunk has been updated
       via  dde5b9902f12c14e5fdea5114f71c74b28d6a1ba (commit)
      from  5e70707066a176b7d7916d561a77e8cf9135f892 (commit)

Summary of changes:
 etc/RT_Config.pm.in                           |    9 +++++++++
 share/html/Download/CustomFieldValue/dhandler |    5 ++++-
 share/html/Ticket/Attachment/dhandler         |    7 +++++--
 3 files changed, 18 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit dde5b9902f12c14e5fdea5114f71c74b28d6a1ba
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Feb 1 18:48:13 2010 -0500

    New config for AlwaysDownloadAttachments

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 4affd1c..5500356 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1069,6 +1069,15 @@ sent in a request (although there is probably more to it than that)
 
 Set($TrustHTMLAttachments, undef);
 
+=item C<$AlwaysDownloadAttachments>
+
+Always download attachments, regardless of content type. If set,
+this overrides C<TrustHTMLAttachments>.
+
+=cut
+
+Set($AlwaysDownloadAttachments, undef);
+
 =item C<$RedistributeAutoGeneratedMessages>
 
 Should RT redistribute correspondence that it identifies as
diff --git a/share/html/Download/CustomFieldValue/dhandler b/share/html/Download/CustomFieldValue/dhandler
index 218de33..d8c7039 100644
--- a/share/html/Download/CustomFieldValue/dhandler
+++ b/share/html/Download/CustomFieldValue/dhandler
@@ -63,7 +63,10 @@ unless ($OCFV->id) {
 
 my $content_type = $OCFV->ContentType || 'text/plain';
     
-unless (RT->Config->Get('TrustHTMLAttachments')) {
+if (RT->Config->Get('AlwaysDownloadAttachments')) {
+    $r->headers_out->{'Content-Disposition'} = "attachment; filename=" . $OCFV->Content;
+}
+elsif (!RT->Config->Get('TrustHTMLAttachments')) {
     $content_type = 'text/plain' if ($content_type =~ /^text\/html/i);
 }
 
diff --git a/share/html/Ticket/Attachment/dhandler b/share/html/Ticket/Attachment/dhandler
index d4d556b..8b41329 100755
--- a/share/html/Ticket/Attachment/dhandler
+++ b/share/html/Ticket/Attachment/dhandler
@@ -68,8 +68,11 @@
      }
 
      my $content_type = $AttachmentObj->ContentType || 'text/plain';
-        
-     unless (RT->Config->Get('TrustHTMLAttachments')) {
+
+     if (RT->Config->Get('AlwaysDownloadAttachments')) {
+         $r->headers_out->{'Content-Disposition'} = "attachment; filename=" . $AttachmentObj->Filename;
+     }
+     elsif (!RT->Config->Get('TrustHTMLAttachments')) {
          $content_type = 'text/plain' if ($content_type =~ /^text\/html/i);
      }
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list