From: Ian Jackson Date: Wed, 5 Sep 2018 13:42:37 +0000 (+0100) Subject: truncation: adjust limit, and fix handling so we can do that in one place X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-ulm.git;a=commitdiff_plain;h=93903c0563cc38afba5a9930ef634e5d4499b6d6 truncation: adjust limit, and fix handling so we can do that in one place Signed-off-by: Ian Jackson (cherry picked from commit 2ef67fd3aed1de70f7271ebccdd4c478f63bcf92) --- diff --git a/stump/bin/submission.pl b/stump/bin/submission.pl index fa98e93..c5d0068 100755 --- a/stump/bin/submission.pl +++ b/stump/bin/submission.pl @@ -345,9 +345,11 @@ sub readMessage { if (!m/^(?:References):/i) { push @unfolded, (m/^[^:]+:/ ? $& : '????') if s/\n(?=.)//g; - if (length $_ > 505) { #wtf - $_ = substr($_, 0, 500); - $_ =~ s/\n?$/\n/; + my $maxlen = 510; + if (length $_ > $maxlen+1) { # $maxlen plus one \n + chomp; + $_ = substr($_, 0, $maxlen); + $_ .= "\n"; $readahead = $_; m/^[0-9a-z-]+/i; $_ = $warning->("Next header ($&) truncated!");