diff options
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index ceaf05f6..603cf094 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -15,7 +15,7 @@ use PublicInbox::MID qw(mid_escape $MID_EXTRACT); use PublicInbox::Eml; use POSIX qw(strftime); use PublicInbox::DS qw(now); -use Digest::SHA qw(sha1_hex); +use PublicInbox::SHA qw(sha1_hex); use Time::Local qw(timegm timelocal); use PublicInbox::GitAsyncCat; use PublicInbox::Address; @@ -188,7 +188,7 @@ sub listgroup_range_i { my ($self, $beg, $end) = @_; my $r = $self->{ibx}->mm(1)->msg_range($beg, $end, 'num'); scalar(@$r) or return; - $self->msg_more(join("\r\n", @$r, '')); + $self->msg_more(join('', map { "$_->[0]\r\n" } @$r)); 1; } @@ -523,8 +523,7 @@ sub msg_hdr_write ($$) { set_nntp_headers($eml, $smsg); my $hdr = $eml->{hdr} // \(my $x = ''); - # fixup old bug from import (pre-a0c07cba0e5d8b6a) - $$hdr =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s; + PublicInbox::Eml::strip_from($$hdr); $$hdr =~ s/(?<!\r)\n/\r\n/sg; # Alpine barfs without this # for leafnode compatibility, we need to ensure Message-ID headers @@ -537,7 +536,11 @@ sub blob_cb { # called by git->cat_async via ibx_async_cat my ($bref, $oid, $type, $size, $smsg) = @_; my $self = $smsg->{nntp}; my $code = $smsg->{nntp_code}; - if (!defined($oid)) { + if (!defined($type)) { + warn "E: git aborted on $oid / $smsg->{blob} ". + $self->{-ibx}->{inboxdir}; + return $self->close; + } elsif ($type ne 'blob') { # it's possible to have TOCTOU if an admin runs # public-inbox-(edit|purge), just move onto the next message warn "E: $smsg->{blob} missing in $smsg->{-ibx}->{inboxdir}\n"; |