]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitweb: fix error in sanitize when highlight is enabled
authorOrgad Shaneh <orgads@gmail.com>
Sun, 30 Dec 2012 11:52:53 +0000 (13:52 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Jan 2013 00:27:27 +0000 (16:27 -0800)
$1 becomes undef by internal regex, since it has no capture groups.

Match against accpetable control characters using index() instead of a regex.

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl

index b67972ec5d9e2ddd78ffccada03361ed0bc63a14..8d34d55884233765ec2bd0cd495c92f8ab5b064e 100755 (executable)
@@ -1538,7 +1538,7 @@ sub sanitize {
        return undef unless defined $str;
 
        $str = to_utf8($str);
-       $str =~ s|([[:cntrl:]])|($1 =~ /[\t\n\r]/ ? $1 : quot_cec($1))|eg;
+       $str =~ s|([[:cntrl:]])|(index("\t\n\r", $1) != -1 ? $1 : quot_cec($1))|eg;
        return $str;
 }