avoid corrupt attachments, #13209 and #13877
authormark <mark>
Wed, 3 Aug 2011 02:24:07 +0000 (02:24 +0000)
committermark <mark>
Wed, 3 Aug 2011 02:24:07 +0000 (02:24 +0000)
httemplate/view/attachment.html
rt/share/html/Ticket/Attachment/dhandler

index 5fc0539..5827e3d 100644 (file)
@@ -1,4 +1,3 @@
-<% $attach->body %>
 <%init>
 my ($query) = $cgi->keywords;
 $query =~ /^(\d+)$/;
@@ -8,9 +7,9 @@ $FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'acces
 my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum";
 die 'access denied' if $attach->disabled;
 
+$r->subprocess_env('no-gzip' => 1); # disable mod_deflate
 $m->clear_buffer;
 $r->content_type($attach->mime_type || 'text/plain');
 $r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename);
-
-
+$m->print($attach->body);
 </%init>
index 8b41329..7330e3c 100755 (executable)
@@ -86,6 +86,7 @@
      #     $content_type = 'application/octet-stream';
      # }
 
+     $r->subprocess_env('no-gzip' => 1); # disable mod_deflate
      $r->content_type( $content_type );
      $m->clear_buffer();
      $m->out($AttachmentObj->OriginalContent);