about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepobrowseGitTree.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-04-07 00:12:59 +0000
committerEric Wong <e@80x24.org>2016-04-07 00:12:59 +0000
commit31c27f13b117efeebded6a89bd66166a60b8f093 (patch)
tree3cc35ff15c2e39e5381597c388bfac05c46e729f /lib/PublicInbox/RepobrowseGitTree.pm
parentdac5d97d60420cb2d23ffb2e83863ab1d09a9669 (diff)
downloadpublic-inbox-31c27f13b117efeebded6a89bd66166a60b8f093.tar.gz
Show some diagnostic information for non-(blob|tree) objects
to perhaps help users figure out what to do with other objects.
Diffstat (limited to 'lib/PublicInbox/RepobrowseGitTree.pm')
-rw-r--r--lib/PublicInbox/RepobrowseGitTree.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/PublicInbox/RepobrowseGitTree.pm b/lib/PublicInbox/RepobrowseGitTree.pm
index b7dd101e..6e25200d 100644
--- a/lib/PublicInbox/RepobrowseGitTree.pm
+++ b/lib/PublicInbox/RepobrowseGitTree.pm
@@ -30,10 +30,15 @@ sub git_tree_stream {
         my $obj = "$id:$req->{expath}";
         my ($hex, $type, $size) = $git->check($obj);
 
-        if (!defined($type) || ($type ne 'blob' && $type ne 'tree')) {
-                return $res->([404, ['Content-Type'=>'text/html'],
+        unless (defined($type)) {
+                return $res->([404, ['Content-Type'=>'text/plain'],
                          ['Not Found']]);
         }
+        if ($type ne 'blob' && $type ne 'tree') {
+                return $res->([404,
+                        ['Content-Type'=>'text/plain; charset=UTF-8'],
+                         ["Unrecognized type ($type) for $obj\n"]]);
+        }
 
         my $fh = $res->([200, ['Content-Type'=>'text/html; charset=UTF-8']]);
         my $opts = { nofollow => 1 };