Skip to content

Commit e65ceb6

Browse files
jnarebgitster
authored andcommitted
gitweb: Fix fixed string (non-regexp) project search
Use $search_regexp, where regex metacharacters are quoted, for searching projects list, rather than $searchtext, which contains original search term. Reported-by: Ramsay Jones <[email protected]> Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f174a25 commit e65ceb6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

gitweb/gitweb.perl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,10 +2905,10 @@ sub filter_forks_from_projects_list {
29052905
sub search_projects_list {
29062906
my ($projlist, %opts) = @_;
29072907
my $tagfilter = $opts{'tagfilter'};
2908-
my $searchtext = $opts{'searchtext'};
2908+
my $search_re = $opts{'search_regexp'};
29092909

29102910
return @$projlist
2911-
unless ($tagfilter || $searchtext);
2911+
unless ($tagfilter || $search_re);
29122912

29132913
my @projects;
29142914
PROJECT:
@@ -2920,10 +2920,10 @@ sub search_projects_list {
29202920
grep { lc($_) eq lc($tagfilter) } keys %{$pr->{'ctags'}};
29212921
}
29222922

2923-
if ($searchtext) {
2923+
if ($search_re) {
29242924
next unless
2925-
$pr->{'path'} =~ /$searchtext/ ||
2926-
$pr->{'descr_long'} =~ /$searchtext/;
2925+
$pr->{'path'} =~ /$search_re/ ||
2926+
$pr->{'descr_long'} =~ /$search_re/;
29272927
}
29282928

29292929
push @projects, $pr;
@@ -5089,17 +5089,17 @@ sub git_project_list_body {
50895089
my $show_ctags = gitweb_check_feature('ctags');
50905090
my $tagfilter = $show_ctags ? $cgi->param('by_tag') : undef;
50915091
$check_forks = undef
5092-
if ($tagfilter || $searchtext);
5092+
if ($tagfilter || $search_regexp);
50935093

50945094
# filtering out forks before filling info allows to do less work
50955095
@projects = filter_forks_from_projects_list(\@projects)
50965096
if ($check_forks);
50975097
@projects = fill_project_list_info(\@projects);
50985098
# searching projects require filling to be run before it
50995099
@projects = search_projects_list(\@projects,
5100-
'searchtext' => $searchtext,
5100+
'search_regexp' => $search_regexp,
51015101
'tagfilter' => $tagfilter)
5102-
if ($tagfilter || $searchtext);
5102+
if ($tagfilter || $search_regexp);
51035103

51045104
$order ||= $default_projects_order;
51055105
$from = 0 unless defined $from;

0 commit comments

Comments
 (0)