Skip to content

Commit ac593b7

Browse files
moygitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 12b1443 commit ac593b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitweb/gitweb.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,8 +2661,8 @@ sub git_get_projects_list {
26612661
my $dir = $projects_list;
26622662
# remove the trailing "/"
26632663
$dir =~ s!/+$!!;
2664-
my $pfxlen = length("$projects_list");
2665-
my $pfxdepth = ($projects_list =~ tr!/!!);
2664+
my $pfxlen = length("$dir");
2665+
my $pfxdepth = ($dir =~ tr!/!!);
26662666
# when filtering, search only given subdirectory
26672667
if ($filter) {
26682668
$dir .= "/$filter";

0 commit comments

Comments
 (0)