]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NNTP.pm
nntp: ensure Message-ID is not folded for leafnode
[public-inbox.git] / lib / PublicInbox / NNTP.pm
index 1d07220de1ec977fb30ba296c93a989f8ddafe11..d409e7828f29e2d6d75f8d8309fee027d3665c69 100644 (file)
@@ -519,6 +519,13 @@ sub _header ($) {
        my $hdr = $_[0]->header_obj->as_string;
        utf8::encode($hdr);
        $hdr =~ s/(?<!\r)\n/\r\n/sg;
+
+       # for leafnode compatibility, we need to ensure Message-ID headers
+       # are only a single line.  We can't subclass Email::Simple::Header
+       # and override _default_fold_at in here, either; since that won't
+       # affect messages already in the archive.
+       $hdr =~ s/^(Message-ID:)[ \t]*\r\n[ \t]+([^\r]+)\r\n/$1 $2\r\n/igsm;
+
        $hdr
 }