Patch for RT 3.4.4 to block inline display of attachments bigger than $MaxInlineBody

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

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

This should already be fixed in 3.4.5rc2