How to reduce the limit of attachment

Hi,

I would like to reduce the maximum size of attachments that can be
added directly from the web interface.

I’m using:

  • Debian 7.5
  • mysql 5.5.37-0+wheezy1
  • RT 4.2.5

I set the value “max_allowed_packet” to “1M” in "/etc/mysql/my.cnf"
and configure these parameters on “/opt/rt4/etc/RT_SiteConfig.pm”:

Set($MaxAttachmentSize, 1_000_000); # 1M
Set($DropLongAttachments, 1_000_000); # 1M

removed the cache:
rm -rf /opt/rt4/var/mason_data/obj

and restarted apache
apache2ctl restart

…but I can upload file that is bigger than 1M.

Any suggestion ?
thank you.

I would like to reduce the maximum size of attachments that can be
added directly from the web interface.

I’m using:

  • Debian 7.5
  • mysql 5.5.37-0+wheezy1
  • RT 4.2.5

I set the value “max_allowed_packet” to “1M” in “/etc/mysql/my.cnf”

You should set it to higher than 1M. Encoding may extend the size of
the object in the database, and MySQL may simply drop the connection if
it gets too large a packet. Having dropped mysql connections will abort
the attachment insert and all sorts of other things, none of which are
desirable.

and configure these parameters on “/opt/rt4/etc/RT_SiteConfig.pm”:

Set($MaxAttachmentSize, 1_000_000); # 1M
Set($DropLongAttachments, 1_000_000); # 1M

$DropLongAttachments is a boolean option:
http://docs.bestpractical.com/RT_Config#DropLongAttachments

It also only works if $TruncateLongAttachments is not set.

removed the cache:
rm -rf /opt/rt4/var/mason_data/obj

For reference, not relevant in this case, as you’ve not changed any
Mason files.

and restarted apache
apache2ctl restart

…but I can upload file that is bigger than 1M.

RT will still allow you to upload files larger than 1M, but will
silently drop them when the correspondence is recorded. There is a
branch in the final stages of review that will add an entry into the
ticket transaction history when an attachment is dropped or truncated.

  • Alex

Thank you Alex for your quick response.

You should set it to higher than 1M. Encoding may extend the size of
the object in the database, and MySQL may simply drop the connection if
it gets too large a packet. Having dropped mysql connections will abort
the attachment insert and all sorts of other things, none of which are
desirable.

Now, I :

  • set “max_allowed_packet = 2M” and restart mysql service.

  • configure these parameters on “/opt/rt4/etc/RT_SiteConfig.pm”:
    Set($MaxAttachmentSize, 1_000_000); # 1M
    Set($DropLongAttachments, 1); # true
    Set($TruncateLongAttachments, undef);

and restarted apache

RT will still allow you to upload files larger than 1M, but will
silently drop them when the correspondence is recorded. There is a
branch in the final stages of review that will add an entry into the
ticket transaction history when an attachment is dropped or truncated.

But I can still upload file (directly from the web interface) that is
bigger than 1M without any message on history.

what am I doing wrong ?

Thanks.

RT will still allow you to upload files larger than 1M, but will
silently drop them when the correspondence is recorded. There is a
branch in the final stages of review that will add an entry into the
ticket transaction history when an attachment is dropped or truncated.

But I can still upload file (directly from the web interface) that is
bigger than 1M without any message on history.

what am I doing wrong ?

I begin to understand.

I checked the RT log and I find this message:
“RT::Attachment=HASH(0xd8318f0): Dropped an attachment of size 4910491”

This is correct, but in the web interface, the attachment is displayed
and it is not clear that the attachment is not accessible until you
select it.

When I select the attachment you receive the message “Large attachment dropped”.

It is possible, when the attachment is dropped, hide the attachment
and report it only in history ?