mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
gitweb: fix esc_param
The custom CGI escaping done in esc_param failed to escape UTF-8 properly. Fix by using CGI::escape on each sequence of matched characters instead of sprintf()ing a custom escaping for each byte. Additionally, the space -> + escape was being escaped due to greedy matching on the first substitution. Fix by adding space to the list of characters not handled on the first substitution. Finally, remove an unnecessary escaping of the + sign. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6ff9ae9f97
commit
452e2256d2
|
@ -1083,8 +1083,7 @@ sub to_utf8 {
|
|||
# correct, but quoted slashes look too horrible in bookmarks
|
||||
sub esc_param {
|
||||
my $str = shift;
|
||||
$str =~ s/([^A-Za-z0-9\-_.~()\/:@])/sprintf("%%%02X", ord($1))/eg;
|
||||
$str =~ s/\+/%2B/g;
|
||||
$str =~ s/([^A-Za-z0-9\-_.~()\/:@ ]+)/CGI::escape($1)/eg;
|
||||
$str =~ s/ /\+/g;
|
||||
return $str;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue