X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FNewsWWW.pm;h=d13731ae3f96b77b1996086647e1868b7615211c;hb=23af251dd607c4e75ab1e68063f2c885c48cc035;hp=61d9ae7cacecbbc4facaeb05d119acdfaf433e95;hpb=0d38f65c490466837ae091afa7a7b6f59d04ce7c;p=public-inbox.git
diff --git a/lib/PublicInbox/NewsWWW.pm b/lib/PublicInbox/NewsWWW.pm
index 61d9ae7c..d13731ae 100644
--- a/lib/PublicInbox/NewsWWW.pm
+++ b/lib/PublicInbox/NewsWWW.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2020 all contributors
+# Copyright (C) 2016-2021 all contributors
# License: AGPL-3.0+
#
# Plack app redirector for mapping /$NEWSGROUP requests to
@@ -45,6 +45,8 @@ sub call {
# some links may have the article number in them:
# /inbox.foo.bar/123456
my (undef, @parts) = split(m!/!, $env->{PATH_INFO});
+ @parts or return
+ [ 404, [qw(Content-Type text/plain)], ["404 Not Found\n"] ];
my ($ng, $article) = @parts;
my $pi_cfg = $self->{pi_cfg};
if (my $ibx = $pi_cfg->lookup_newsgroup($ng)) {
@@ -80,7 +82,8 @@ sub call {
for (@$xr3) {
s/:[0-9]+:$x->{blob}\z// or next;
my $ibx = $by_eidx_key->{$_} // next;
- my $url = $ibx->base_url or next;
+ my $url = $ALL->base_url($env) //
+ $ibx->base_url // next;
$url .= mid_escape($mid) . '/';
return redirect(302, $url);
}