]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NewsWWW.pm
config: fix NewsWWW fallback for newsgroups in HTTP URLs
[public-inbox.git] / lib / PublicInbox / NewsWWW.pm
index 19eb596cea2a1563489ae2d6107a8e3643248cec..5357059dee21733a4d9f537f591fd0376ea5fda8 100644 (file)
@@ -30,7 +30,6 @@ sub call {
        if (my $info = $ng_map->{$ng}) {
                my $url = PublicInbox::Hval::prurl($env, $info->{url});
                my $code = 301;
-               my $h = [ Location => $url, 'Content-Type' => 'text/plain' ];
                if (defined $article && $article =~ /\A\d+\z/) {
                        my $mid = eval { ng_mid_for($ng, $info, $article) };
                        if (defined $mid) {
@@ -41,6 +40,8 @@ sub call {
                        }
                }
 
+               my $h = [ Location => $url, 'Content-Type' => 'text/plain' ];
+
                return [ $code, $h, [ "Redirecting to $url\n" ] ]
        }
        [ 404, [ 'Content-Type' => 'text/plain' ], [] ];