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

John Sloan jnsloan at gmail.com
Thu Jan 12 10:19:54 EST 2006


I am running RT 3.4.4 on SuSE 10.0, with the default install.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20060112/e87a9b79/attachment.htm>


More information about the rt-users mailing list