[rt-users] Patch for RT 3.4.4 to block inline display of attachments bigger than $MaxInlineBody.

Jesse Vincent jesse at bestpractical.com
Thu Jan 12 10:23:17 EST 2006




On Thu, Jan 12, 2006 at 10:19:54AM -0500, John Sloan wrote:
> I am running RT 3.4.4 on SuSE 10.0, with the default install.


This should already be fixed in 3.4.5rc2

> 
> The variable $MaxInlineBodydoes not seem to be respected in
> /opt/rt3/share/html/Ticket/Elements/ShowTransactionAttachments.
> 
> It looks like the variable "$size" is used to store the attachment size in
> bytes, then it is reused to store a "pretty string" describing the file size
> (eg. 2048k or 89b.) Then it is used again to compare the attachment size to
> the value of MaxInlineBody, which doesn't work since $size is no longer the
> size of the attachment in bytes.
> 
> To fix this, I added a local variable named "$size_pretty" to store the
> "pretty string". This solved the problem. Hopefully, it will be useful to
> someone else!
> 
> Here's the diff for ShowTransactionAttachments:
> 
> 72c72
> <
> ---
> >      my $size_pretty;
> 75c75
> <          $size = loc( "[_1]k", int( $size / 102.4 ) / 10 );
> ---
> >          $size_pretty = loc( "[_1]k", int( $size / 102.4 ) / 10 );
> 78c78
> <         $size = loc( "[_1]b", $size );
> ---
> >         $size_pretty = loc( "[_1]b", $size );
> 84c84
> < <%$message->ContentType%> <% $size %>
> ---
> > <%$message->ContentType%> <% $size_pretty %>
> 
> _______________________________________
> 
> John Sloan

> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Be sure to check out the RT Wiki at http://wiki.bestpractical.com
> 
> Download a free sample chapter of RT Essentials from O'Reilly Media at http://rtbook.bestpractical.com
> 
> WE'RE COMING TO YOUR TOWN SOON - RT Training in Amsterdam, Boston and
> San Francisco - Find out more at http://bestpractical.com/services/training.html

-- 



More information about the rt-users mailing list