gitweb: fix error in sanitize when highlight is enabled
$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>
Orgad Shaneh committed
Dec 30, 2012 at 13:52 UTC
0e901d24fd70630ffed5411e6217c2dfce9c8da6
1 file changed
+1
-1
gitweb/gitweb.perl
+1
-1
@@ -1538,7 +1538,7 @@ sub sanitize {
1538
return undef unless defined $str;
1539
1540
$str = to_utf8($str);
1541
- $str =~ s|([[:cntrl:]])|($1 =~ /[\t\n\r]/ ? $1 : quot_cec($1))|eg;
1541
+ $str =~ s|([[:cntrl:]])|(index("\t\n\r", $1) != -1 ? $1 : quot_cec($1))|eg;
1542
return $str;
1543
}
1544