Tronquer le sujet uniquement si besoin

This commit is contained in:
Daniel Berteaud 2012-10-11 13:25:14 +02:00
parent e26674e3af
commit 60441b6b0e
1 changed files with 2 additions and 2 deletions

View File

@ -140,12 +140,12 @@ $header->add("X-Sql-Log-ID",$mail_id);
my $subject = scalar $header->get("Subject");
chomp($subject);
# Only keep the first 255 chars to be sure it can be inserted in the table
$subject= substr $subject, 0, 254;
$subject= substr $subject, 0, 254 if (length($subject) > 254);
my($statement) = "UPDATE ".$mail_table." SET subject=".
$dbh->quote($subject).
",header_size=".$dbh->quote(length($header->as_string())).
",body_size=".$dbh->quote($transaction->body_size()).
",body_size=".$dbh->quote($transaction->data_size()).
" WHERE mail_id=".$mail_id;
$self->log(LOGDEBUG,"data_post_handler statement:".$statement);