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>
This commit is contained in:
Matthieu Moy 2012-01-04 11:07:45 +01:00 коммит произвёл Junio C Hamano
Родитель 12b1443c2c
Коммит ac593b76dd
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -2661,8 +2661,8 @@ sub git_get_projects_list {
my $dir = $projects_list;
# remove the trailing "/"
$dir =~ s!/+$!!;
my $pfxlen = length("$projects_list");
my $pfxdepth = ($projects_list =~ tr!/!!);
my $pfxlen = length("$dir");
my $pfxdepth = ($dir =~ tr!/!!);
# when filtering, search only given subdirectory
if ($filter) {
$dir .= "/$filter";