Skip to content

Commit aa145bf

Browse files
committed
Merge branch 'jn/maint-do-not-match-with-unsanitized-searchtext'
By Jakub Narebski * jn/maint-do-not-match-with-unsanitized-searchtext: gitweb: Fix fixed string (non-regexp) project search Conflicts: gitweb/gitweb.perl
2 parents 2c54517 + e65ceb6 commit aa145bf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

gitweb/gitweb.perl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,15 +3073,15 @@ sub filter_forks_from_projects_list {
30733073
sub search_projects_list {
30743074
my ($projlist, %opts) = @_;
30753075
my $tagfilter = $opts{'tagfilter'};
3076-
my $searchtext = $opts{'searchtext'};
3076+
my $search_re = $opts{'search_regexp'};
30773077

30783078
return @$projlist
3079-
unless ($tagfilter || $searchtext);
3079+
unless ($tagfilter || $search_re);
30803080

30813081
# searching projects require filling to be run before it;
30823082
fill_project_list_info($projlist,
30833083
$tagfilter ? 'ctags' : (),
3084-
$searchtext ? ('path', 'descr') : ());
3084+
$search_re ? ('path', 'descr') : ());
30853085
my @projects;
30863086
PROJECT:
30873087
foreach my $pr (@$projlist) {
@@ -3092,10 +3092,10 @@ sub search_projects_list {
30923092
grep { lc($_) eq lc($tagfilter) } keys %{$pr->{'ctags'}};
30933093
}
30943094

3095-
if ($searchtext) {
3095+
if ($search_re) {
30963096
next unless
3097-
$pr->{'path'} =~ /$searchtext/ ||
3098-
$pr->{'descr_long'} =~ /$searchtext/;
3097+
$pr->{'path'} =~ /$search_re/ ||
3098+
$pr->{'descr_long'} =~ /$search_re/;
30993099
}
31003100

31013101
push @projects, $pr;
@@ -5484,16 +5484,16 @@ sub git_project_list_body {
54845484
my $show_ctags = gitweb_check_feature('ctags');
54855485
my $tagfilter = $show_ctags ? $input_params{'ctag'} : undef;
54865486
$check_forks = undef
5487-
if ($tagfilter || $searchtext);
5487+
if ($tagfilter || $search_regexp);
54885488

54895489
# filtering out forks before filling info allows to do less work
54905490
@projects = filter_forks_from_projects_list(\@projects)
54915491
if ($check_forks);
54925492
# search_projects_list pre-fills required info
54935493
@projects = search_projects_list(\@projects,
5494-
'searchtext' => $searchtext,
5494+
'search_regexp' => $search_regexp,
54955495
'tagfilter' => $tagfilter)
5496-
if ($tagfilter || $searchtext);
5496+
if ($tagfilter || $search_regexp);
54975497
# fill the rest
54985498
@projects = fill_project_list_info(\@projects);
54995499

0 commit comments

Comments
 (0)