From 2ef67fd3aed1de70f7271ebccdd4c478f63bcf92 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 5 Sep 2018 14:42:37 +0100 Subject: [PATCH] truncation: adjust limit, and fix handling so we can do that in one place Signed-off-by: Ian Jackson --- stump/bin/submission.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stump/bin/submission.pl b/stump/bin/submission.pl index e1ca104..cb12a29 100755 --- a/stump/bin/submission.pl +++ b/stump/bin/submission.pl @@ -351,9 +351,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!"); -- 2.30.2