[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#202015: Package search for "g++" broken for second and subsequent result pages



tags 202015 + patch
thanks

On Fri, Jul 18, 2003 at 07:30:36PM -0700, Robert Fleming wrote:
> Searching for packages containing files like "g++", the "+" characters 
> are properly encoded (by the web browser) in the "word" parameter in the 
> URL by the search form at http://www.debian.org/distrib/packages as follows:
> 
>    search_contents.pl?word=g%2B%2B ...
> 
> but the links for subsequent search result pages look like:
> 
>    search_contents.pl?page=2&word=g++ ...
> 
> where "g++" should be "g%2B%2B".
> 
> Clicking on these links results in this error:
> 
>    Error: "g " is not a valid search request

I made a patch. It uses the URI::Escape modul which is part of package
liburi-perl.

Gruesse,
-- 
*** Frank Lichtenheld <frank@lichtenheld.de> ***
          *** http://www.djpig.de/ ***
see also: - http://www.usta.de/
          - http://fachschaft.physik.uni-karlsruhe.de/
Index: search_contents.pl
===================================================================
RCS file: /cvs/webwml/packages/cgi-bin/search_contents.pl,v
retrieving revision 1.4
diff -u -r1.4 search_contents.pl
--- search_contents.pl	3 Jul 2003 21:59:32 -0000	1.4
+++ search_contents.pl	19 Jul 2003 09:54:27 -0000
@@ -13,6 +13,7 @@
 use strict;
 use CGI;
 use POSIX;
+use URI::Escape;
 
 my $thisscript = "search_contents.pl";
 
@@ -145,9 +146,10 @@
 my $index_line = "";
 
 for (my $i = 1; $i <= $numpages; $i++) {
-	$index_line .= "<a href=\"$thisscript?page=$i&word=$keyword".
-                    "&version=$version&arch=$arch&case=$case".
-                    "&searchmode=$searchmode\">$i</a>\n";
+        my $url_keyword = uri_escape( $keyword );
+	$index_line .= "<a href=\"$thisscript?page=$i&amp;word=$url_keyword".
+                    "&amp;version=$version&amp;arch=$arch&amp;case=$case".
+                    "&amp;searchmode=$searchmode\">$i</a>\n";
 	if ($i < $numpages) {
 	   $index_line .= " | ";
 	}

Reply to: