gitweb: accept trailing "/" in $project_list

The current code is removing the trailing "/", but computing the string length on the previous value, i.e. with the trailing "/". Later in the code, we do my $path = substr($File::Find::name, $pfxlen + 1); And the "$pfxlen + 1" is supposed to mean "the length of the prefix, plus 1 for the / separating the prefix and the path", but with an incorrect $pfxlen, this basically eats the first character of the path, and yields "404 - No projects found". While we're there, also fix $pfxdepth to use $dir, although a change of 1 in the depth shouldn't really matter. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthieu Moy committed Jan 4, 2012 at 11:07 UTC ac593b76dde42fa8340fb60e7d6fc315a5be7c40
1 file changed +2 -2
gitweb/gitweb.perl
+2 -2
@@ -2661,8 +2661,8 @@ sub git_get_projects_list {
2661 my $dir = $projects_list;
2662 # remove the trailing "/"
2663 $dir =~ s!/+$!!;
2664 - my $pfxlen = length("$projects_list");
2665 - my $pfxdepth = ($projects_list =~ tr!/!!);
2664 + my $pfxlen = length("$dir");
2665 + my $pfxdepth = ($dir =~ tr!/!!);
2666 # when filtering, search only given subdirectory
2667 if ($filter) {
2668 $dir .= "/$filter";