#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
}
}
+my $max_size = RT->Config->Get('MaxFulltextAttachmentSize');
+
my $db_type = RT->Config->Get('DatabaseType');
my $fts_config = $ENV{RT_FTS_CONFIG} ? JSON::from_json($ENV{RT_FTS_CONFIG})
: RT->Config->Get('FullTextSearch') || {};
my ($attachments) = @_;
my @insert;
my $found = 0;
+
while ( my $a = $attachments->Next ) {
debug("Found attachment #". $a->id );
+ if ( $max_size and $a->ContentLength > $max_size ){
+ debug("Attachment #" . $a->id . " is " . $a->ContentLength .
+ " bytes which is larger than configured MaxFulltextAttachmentSize " .
+ " of " . $max_size . ", skipping");
+ next;
+ }
+
my $text = $a->Content // "";
HTML::Entities::decode_entities($text) if $a->ContentType eq "text/html";
push @insert, $text, $a->id;
attachment_loop( sub {
my ($attachments) = @_;
my @insert;
+
while ( my $a = $attachments->Next ) {
debug("Found attachment #". $a->id );
+ if ( $max_size and $a->ContentLength > $max_size ){
+ debug("Attachment #" . $a->id . " is " . $a->ContentLength .
+ " bytes which is larger than configured MaxFulltextAttachmentSize " .
+ " of " . $max_size . ", skipping");
+ next;
+ }
+
my $text = $a->Content // "";
HTML::Entities::decode_entities($text) if $a->ContentType eq "text/html";