unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/2] nntp: fix for missing articles/bodies/heads
Date: Sun, 29 May 2016 04:16:44 +0000	[thread overview]
Message-ID: <20160529041644.345-3-e@80x24.org> (raw)
In-Reply-To: <20160529041644.345-1-e@80x24.org>

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 58b86a8..232237c 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 c5bc0b5..5f4ba57 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('<nntp@example.com>'), 'HEAD OK');
+	is_deeply($n->body(1), $n->body('<nntp@example.com>'), 'BODY OK');
+	my $art = $n->article(1);
+	is(ref($art), 'ARRAY', 'got array for ARTICLE');
+	is_deeply($art, $n->article('<nntp@example.com>'), 'ARTICLE OK');
+	is($n->article(999), undef, 'non-existent num');
+	is($n->article('<non-existent@example>'), undef, 'non-existent mid');
+
 	{
 		syswrite($s, "OVER $mid\r\n");
 		$buf = read_til_dot($s);

      parent reply	other threads:[~2016-05-29  4:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-29  4:16 [PATCH 0/2] nntp fixes Eric Wong
2016-05-29  4:16 ` [PATCH 1/2] inbox: drop references ASAP for search and msgmap Eric Wong
2016-05-29  4:16 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160529041644.345-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).