Skip to content

Commit f70dda2

Browse files
jnarebgitster
authored andcommitted
gitweb: Fix "next" link on bottom of page
Fix search form generation to not modify $cgi->param(...)'s. In git_header_html() we used to use $cgi->hidden(-name => "a") etc. to generate hidden fields; unfortunately to use this form it is required to modify $cgi->param("a") etc., which makes href(-replay,...) use wrong replay values. This for example made the "next" link on the bottom of the page has a=search instead of a=$action, and thus fails to get you to the next page. Because in CGI the value of a hidden field is "sticky", there is no way to modify it short of modifying $cgi->param(...). Therefore it got replaced by generating <input type="hidden" ...> element [semi] directly. Alternate solution would be for href(-replay,...) to use values saved in global variables, such as $action etc., instead of (re)reading them from $cgi->param($symbol). The bad link was reported by Kai Blin through http://bugs.debian.org/481902 Reported-by: Kai Blin <kai.blin@gmail.com> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Tested-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3db4723 commit f70dda2

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

gitweb/gitweb.perl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ sub git_header_html {
26232623
print "</div>\n";
26242624

26252625
my ($have_search) = gitweb_check_feature('search');
2626-
if ((defined $project) && ($have_search)) {
2626+
if (defined $project && $have_search) {
26272627
if (!defined $searchtext) {
26282628
$searchtext = "";
26292629
}
@@ -2639,16 +2639,13 @@ sub git_header_html {
26392639
my ($use_pathinfo) = gitweb_check_feature('pathinfo');
26402640
if ($use_pathinfo) {
26412641
$action .= "/".esc_url($project);
2642-
} else {
2643-
$cgi->param("p", $project);
26442642
}
2645-
$cgi->param("a", "search");
2646-
$cgi->param("h", $search_hash);
26472643
print $cgi->startform(-method => "get", -action => $action) .
26482644
"<div class=\"search\">\n" .
2649-
(!$use_pathinfo && $cgi->hidden(-name => "p") . "\n") .
2650-
$cgi->hidden(-name => "a") . "\n" .
2651-
$cgi->hidden(-name => "h") . "\n" .
2645+
(!$use_pathinfo &&
2646+
$cgi->input({-name=>"p", -value=>$project, -type=>"hidden"}) . "\n") .
2647+
$cgi->input({-name=>"a", -value=>"search", -type=>"hidden"}) . "\n" .
2648+
$cgi->input({-name=>"h", -value=>$search_hash, -type=>"hidden"}) . "\n" .
26522649
$cgi->popup_menu(-name => 'st', -default => 'commit',
26532650
-values => ['commit', 'grep', 'author', 'committer', 'pickaxe']) .
26542651
$cgi->sup($cgi->a({-href => href(action=>"search_help")}, "?")) .

0 commit comments

Comments
 (0)