about summary refs log tree commit homepage
path: root/lib/PublicInbox/ViewVCS.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-07 20:37:34 +0000
committerEric Wong <e@yhbt.net>2020-07-10 11:27:05 +0000
commitbc18c05b1681acc9a468b298c34b12ca4db3e5bb (patch)
tree72da4c4bc1c5f387e0e66b1fccb482a022a123ed /lib/PublicInbox/ViewVCS.pm
parent17d4b5796d44b2c7a3a0335f174503c1f18b4347 (diff)
downloadpublic-inbox-bc18c05b1681acc9a468b298c34b12ca4db3e5bb.tar.gz
This means we need to filter out "" from query parameters.
While we're at it, update comments for the WWW endpoint.
Diffstat (limited to 'lib/PublicInbox/ViewVCS.pm')
-rw-r--r--lib/PublicInbox/ViewVCS.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm
index 9ec04f48..053848a8 100644
--- a/lib/PublicInbox/ViewVCS.pm
+++ b/lib/PublicInbox/ViewVCS.pm
@@ -127,7 +127,7 @@ sub solve_result {
 
         my ($git, $oid, $type, $size, $di) = @$res;
         return show_other($ctx, $res, \$log, $fn) if $type ne 'blob';
-        my $path = to_filename($di->{path_b} || $hints->{path_b} || 'blob');
+        my $path = to_filename($di->{path_b} // $hints->{path_b} // 'blob');
         my $raw_link = "(<a\nhref=$path>raw</a>)";
         if ($size > $MAX_SIZE) {
                 return stream_large_blob($ctx, $res, \$log, $fn) if defined $fn;
@@ -184,13 +184,15 @@ sub solve_result {
         html_page($ctx, 200, \$log);
 }
 
+# GET /$INBOX/$GIT_OBJECT_ID/s/
+# GET /$INBOX/$GIT_OBJECT_ID/s/$FILENAME
 sub show ($$;$) {
         my ($ctx, $oid_b, $fn) = @_;
         my $qp = $ctx->{qp};
         my $hints = $ctx->{hints} = {};
         while (my ($from, $to) = each %QP_MAP) {
                 defined(my $v = $qp->{$from}) or next;
-                $hints->{$to} = $v;
+                $hints->{$to} = $v if $v ne '';
         }
 
         $ctx->{'log'} = tmpfile("solve.$oid_b");