gitweb: Drop the href() params which keys are not in %mapping
authorJakub Narebski <jnareb@gmail.com>
Tue, 22 Aug 2006 17:05:24 +0000 (19:05 +0200)
committerJunio C Hamano <junkio@cox.net>
Tue, 22 Aug 2006 23:12:26 +0000 (16:12 -0700)
If someone would enter parameter name incorrectly, and some key of
%params is not found in %mapping hash, the parameter is now
ignored. Change introduced by Martin Waitz in commit
  756d2f064b2419fcdf9cd9c851f352e2a4f75103
tried to do that, but it left empty value and there was doubled ";;"
in returned string.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl

index 1c8a2ebe1509a89e20a4794767d5f16796f20492..43b1600486c4c71c5004e42f918381110fec5224 100755 (executable)
@@ -285,7 +285,7 @@ sub href(%) {
        my $href = "$my_uri?";
        $href .= esc_param( join(";",
                map {
-                       "$mapping{$_}=$params{$_}" if defined $params{$_}
+                       defined $params{$_} ? "$mapping{$_}=$params{$_}" : ()
                } keys %params
        ) );