user/dev discussion of public-inbox itself
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
			download mbox.gz: |
* [PATCH] view: handle the topic-free case properly
@ 2020-04-03  5:06  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2020-04-03  5:06 UTC (permalink / raw)
  To: meta

There may be no topics for a given timestamp range,
so don't attempt to treat `undef' as an arrayref.
---
 lib/PublicInbox/View.pm | 2 +-
 t/psgi_v2.t             | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 89174296..c42654b6 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -1056,7 +1056,7 @@ sub acc_topic { # walk_thread callback
 sub dump_topics {
 	my ($ctx) = @_;
 	my $order = delete $ctx->{order}; # [ ds, subj1, subj2, subj3, ... ]
-	if (!@$order) {
+	unless ($order) {
 		$ctx->{-html_tip} = '<pre>[No topics in range]</pre>';
 		return 404;
 	}
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 2c9387a4..c4f80869 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -250,6 +250,8 @@ test_psgi(sub { $www->call(@_) }, sub {
 		is($old->content, 'old', 'got expected old content');
 		is($new->content, 'new', 'got expected new content');
 	}
+	$res = $cb->(GET('/v2test/?t=1970'.'01'.'01'.'000000'));
+	is($res->code, 404, '404 for out-of-range t= param');
 });
 
 done_testing();

^ permalink raw reply	[relevance 7%]

Results 1-1 of 1 | reverse
2020-04-03  5:06  7% [PATCH] view: handle the topic-free case properly Eric Wong

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git