From 9665b1ffe0c5417e54ccd313794577d7c62c429c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 29 May 2016 04:10:48 +0000 Subject: [PATCH] nntp: fix for missing articles/bodies/heads Oops, we totally forgot to automate testing for this :x --- lib/PublicInbox/NNTP.pm | 2 +- t/nntpd.t | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 58b86a82..232237c2 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -485,7 +485,7 @@ find_mid: found: my $o = 'HEAD:' . mid2path($mid); my $bytes; - my $s = eval { Email::Simple->new($ng->gcf->cat_file($o, \$bytes)) }; + my $s = eval { Email::Simple->new($ng->git->cat_file($o, \$bytes)) }; return $err unless $s; my $lines; if ($set_headers) { diff --git a/t/nntpd.t b/t/nntpd.t index c5bc0b54..5f4ba57b 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -173,6 +173,14 @@ EOF $len, '1' ] }, "XOVER by article works"); + is_deeply($n->head(1), $n->head(''), 'HEAD OK'); + is_deeply($n->body(1), $n->body(''), 'BODY OK'); + my $art = $n->article(1); + is(ref($art), 'ARRAY', 'got array for ARTICLE'); + is_deeply($art, $n->article(''), 'ARTICLE OK'); + is($n->article(999), undef, 'non-existent num'); + is($n->article(''), undef, 'non-existent mid'); + { syswrite($s, "OVER $mid\r\n"); $buf = read_til_dot($s); -- 2.44.0