Subject: Re: [RFD] gitweb: href() function to generate URLs for CGI

From: Jakub Narebski <[email-masked]>
Date: Tue, 22 Aug 2006 11:34:46 +0200

Junio C Hamano wrote:

> So the last part of the above should perhaps read:
> 
>         my @result = (); 
>         for (my $i = 0; $i < @mapping; $i += 2) {
>                 my ($name, $symbol) = ($mapping[$i], $mapping[$i+1]);
>                 if (defined $params{$name}) {
>                         push @result, join('=', esc_param($symbol),
>                                                 esc_param($params{$name}));
>                 }
>         }

There is really no need to escape $symbol; we control this,
and it is CGI param safe.

BTW. why use join? The following

        push @result, "$symbol=" . esc_param($params{$name}); 

would be simplier... we could even use

        $href .= ($i > 0? ";" : "") . "$symbol=" . esc_param($params{$name});

although probably this isn't best idea (worse readibility).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git