Skip to content

Commit 35c60a0

Browse files
committed
Merge branch 'jn/gitweb-search-utf-8' into maint
* jn/gitweb-search-utf-8: gitweb: Allow UTF-8 encoded CGI query parameters and path_info
2 parents 6c63ab3 + 84d9e2d commit 35c60a0

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
@@ -52,7 +52,7 @@ sub evaluate_uri {
5252
# as base URL.
5353
# Therefore, if we needed to strip PATH_INFO, then we know that we have
5454
# to build the base URL ourselves:
55-
our $path_info = $ENV{"PATH_INFO"};
55+
our $path_info = decode_utf8($ENV{"PATH_INFO"});
5656
if ($path_info) {
5757
if ($my_url =~ s,\Q$path_info\E$,, &&
5858
$my_uri =~ s,\Q$path_info\E$,, &&
@@ -816,9 +816,9 @@ sub evaluate_query_params {
816816

817817
while (my ($name, $symbol) = each %cgi_param_mapping) {
818818
if ($symbol eq 'opt') {
819-
$input_params{$name} = [ $cgi->param($symbol) ];
819+
$input_params{$name} = [ map { decode_utf8($_) } $cgi->param($symbol) ];
820820
} else {
821-
$input_params{$name} = $cgi->param($symbol);
821+
$input_params{$name} = decode_utf8($cgi->param($symbol));
822822
}
823823
}
824824
}
@@ -2765,7 +2765,7 @@ sub git_populate_project_tagcloud {
27652765
}
27662766

27672767
my $cloud;
2768-
my $matched = $cgi->param('by_tag');
2768+
my $matched = $input_params{'ctag'};
27692769
if (eval { require HTML::TagCloud; 1; }) {
27702770
$cloud = HTML::TagCloud->new;
27712771
foreach my $ctag (sort keys %ctags_lc) {
@@ -3871,7 +3871,7 @@ sub print_search_form {
38713871
-values => ['commit', 'grep', 'author', 'committer', 'pickaxe']) .
38723872
$cgi->sup($cgi->a({-href => href(action=>"search_help")}, "?")) .
38733873
" search:\n",
3874-
$cgi->textfield(-name => "s", -value => $searchtext) . "\n" .
3874+
$cgi->textfield(-name => "s", -value => $searchtext, -override => 1) . "\n" .
38753875
"<span title=\"Extended regular expression\">" .
38763876
$cgi->checkbox(-name => 'sr', -value => 1, -label => 're',
38773877
-checked => $search_use_regexp) .
@@ -5280,7 +5280,7 @@ sub git_project_list_body {
52805280

52815281
my $check_forks = gitweb_check_feature('forks');
52825282
my $show_ctags = gitweb_check_feature('ctags');
5283-
my $tagfilter = $show_ctags ? $cgi->param('by_tag') : undef;
5283+
my $tagfilter = $show_ctags ? $input_params{'ctag'} : undef;
52845284
$check_forks = undef
52855285
if ($tagfilter || $searchtext);
52865286

@@ -5992,7 +5992,7 @@ sub git_project_list {
59925992
}
59935993
print $cgi->startform(-method => "get") .
59945994
"<p class=\"projsearch\">Search:\n" .
5995-
$cgi->textfield(-name => "s", -value => $searchtext) . "\n" .
5995+
$cgi->textfield(-name => "s", -value => $searchtext, -override => 1) . "\n" .
59965996
"</p>" .
59975997
$cgi->end_form() . "\n";
59985998
git_project_list_body(\@list, $order);
@@ -6195,7 +6195,7 @@ sub git_tag {
61956195

61966196
sub git_blame_common {
61976197
my $format = shift || 'porcelain';
6198-
if ($format eq 'porcelain' && $cgi->param('js')) {
6198+
if ($format eq 'porcelain' && $input_params{'javascript'}) {
61996199
$format = 'incremental';
62006200
$action = 'blame_incremental'; # for page title etc
62016201
}

0 commit comments

Comments
 (0)