]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
viewvcs: avoid uninitialized var on unusable filenames
authorEric Wong <e@80x24.org>
Sat, 8 Apr 2023 20:08:36 +0000 (20:08 +0000)
committerEric Wong <e@80x24.org>
Sat, 8 Apr 2023 20:12:27 +0000 (20:12 +0000)
This happens if somebody uses a bogus filename like `.' for the
`b=' parameter (e.g. GET `$REPO/$OID/?b=.').

lib/PublicInbox/ViewVCS.pm

index de8600ee10ea8098ba5a5369a38b8f99b35fac1c..eb757089cd642b1aae0e537f5af7b1df49ad2e19 100644 (file)
@@ -514,7 +514,7 @@ sub solve_result {
        return show_other($ctx, $res) if $type ne 'blob';
        my $fn = $di->{path_b} // $hints->{path_b};
        my $paths = $ctx->{-paths} //= do {
-               my $path = to_filename($fn // 'blob');
+               my $path = to_filename($fn // 'blob') // 'blob';
                my $raw_more = qq[(<a\nhref="$path">raw</a>)];
                my @def;