chiark / gitweb /
truncation: adjust limit, and fix handling so we can do that in one place
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Sep 2018 13:42:37 +0000 (14:42 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Sep 2018 13:53:10 +0000 (14:53 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
(cherry picked from commit 2ef67fd3aed1de70f7271ebccdd4c478f63bcf92)

stump/bin/submission.pl

index fa98e930f7b3abc5978bf787126b72686b438585..c5d00686c5d4d1b1bff6559e7199bfb10bcc2c01 100755 (executable)
@@ -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!");