X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/42de3c30fd1944ef90e23f370566fee62c7d9a6b0563ff16c641280de58b44fd..3b440e54ef61f449b8ec3704a9b8d2857ccfd648e97fc885c1d102c59a571600:/gitweb.perl diff --git a/gitweb.perl b/gitweb.perl index abc45b2..b75a81b 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -443,6 +443,15 @@ sub esc_param { return $str; } +# quote unsafe chars in whole URL, so some charactrs cannot be quoted +sub esc_url { + my $str = shift; + $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&=])/sprintf("%%%02X", ord($1))/eg; + $str =~ s/\+/%2B/g; + $str =~ s/ /\+/g; + return $str; +} + # replace invalid utf8 character with SUBSTITUTION sequence sub esc_html { my $str = shift; @@ -1359,7 +1368,7 @@ EOF "" . "\"git\"" . "\n"; - print $cgi->a({-href => esc_param($home_link)}, $home_link_str) . " / "; + print $cgi->a({-href => esc_url($home_link)}, $home_link_str) . " / "; if (defined $project) { print $cgi->a({-href => href(action=>"summary")}, esc_html($project)); if (defined $action) {