Skip to content

Commit

Permalink
Merge branch 'jn/gitweb-search-utf-8' into maint
Browse files Browse the repository at this point in the history
* jn/gitweb-search-utf-8:
  gitweb: Allow UTF-8 encoded CGI query parameters and path_info
  • Loading branch information
Junio C Hamano committed Feb 16, 2012
2 parents 6c63ab3 + 84d9e2d commit 35c60a0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sub evaluate_uri {
# as base URL.
# Therefore, if we needed to strip PATH_INFO, then we know that we have
# to build the base URL ourselves:
our $path_info = $ENV{"PATH_INFO"};
our $path_info = decode_utf8($ENV{"PATH_INFO"});
if ($path_info) {
if ($my_url =~ s,\Q$path_info\E$,, &&
$my_uri =~ s,\Q$path_info\E$,, &&
Expand Down Expand Up @@ -816,9 +816,9 @@ sub evaluate_query_params {

while (my ($name, $symbol) = each %cgi_param_mapping) {
if ($symbol eq 'opt') {
$input_params{$name} = [ $cgi->param($symbol) ];
$input_params{$name} = [ map { decode_utf8($_) } $cgi->param($symbol) ];
} else {
$input_params{$name} = $cgi->param($symbol);
$input_params{$name} = decode_utf8($cgi->param($symbol));
}
}
}
Expand Down Expand Up @@ -2765,7 +2765,7 @@ sub git_populate_project_tagcloud {
}

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

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

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

sub git_blame_common {
my $format = shift || 'porcelain';
if ($format eq 'porcelain' && $cgi->param('js')) {
if ($format eq 'porcelain' && $input_params{'javascript'}) {
$format = 'incremental';
$action = 'blame_incremental'; # for page title etc
}
Expand Down

0 comments on commit 35c60a0

Please sign in to comment.