--- /usr/lib/cgi-bin/cvsweb.orig	2004-05-05 07:51:04.000000000 +0200
+++ /usr/lib/cgi-bin/cvsweb	2004-05-05 09:43:05.000000000 +0200
@@ -302,17 +302,17 @@
 $doCheckout    =  ($where =~ m|^/$CheckoutMagic/|o);
 $where         =~ s|^/$CheckoutMagic/|/|o;
 $where         =~ s|^/||;
-$scriptname    =~ s|^/*|/|;
+$scriptname    =~ s|^/+|/|;
 
 # Let's workaround thttpd's stupidity..
-if ($scriptname =~ m|/$|) {
+if ($ENV{'SERVER_SOFTWARE'} =~ m|thttpd| && $scriptname =~ m|/$|) {
   $pathinfo .= '/';
   my $re = quotemeta $pathinfo;
   $scriptname =~ s/$re$//;
 }
 
 $scriptwhere  = $scriptname;
-$scriptwhere .= '/' . urlencode($where);
+$scriptwhere .= '/' . urlencode($where) if ($where);
 $where = '/' if ($where eq '');
 
 # In text-based browsers, it's very annoying to have two links per file;
@@ -383,6 +383,7 @@
 
 my %query = ();
 if (defined($ENV{QUERY_STRING})) {
+  $ENV{QUERY_STRING} = uri_unescape($ENV{QUERY_STRING});
   for my $p (split(/[;&]+/, $ENV{QUERY_STRING})) {
     next unless $p;
     $p =~ y/+/ /;
