From: Jakub Narebski Date: Sat, 16 Feb 2008 22:07:46 +0000 (+0100) Subject: gitweb: Fix displaying unchopped argument in chop_and_escape_str X-Git-Tag: v1.5.5-rc0~200 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=850b90a51d5ed122cee5c2f3ad4c3e513a05259a;p=git.git gitweb: Fix displaying unchopped argument in chop_and_escape_str Do not use esc_html to escape [title] _attribute_ of a HTML element, and quote unprintable characters. Replace unprintable characters by '?' and use CGI method to generate HTML element and do the escaping. This caused bug noticed by Martin Koegler, Message-ID: <20080216130037.GA14571@auto.tuwien.ac.at> that for bad commit encoding in author name, the title attribute (here to show full, not shortened name) had embedded HTML code in it, result of quoting unprintable characters the gitweb/HTML way. This of course broke the HTML, causing page being not displayed in XML validating web browsers. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 5e88637b5..47e3a4134 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -866,8 +866,8 @@ sub chop_and_escape_str { if ($chopped eq $str) { return esc_html($chopped); } else { - return qq{} . - esc_html($chopped) . qq{}; + $str =~ s/([[:cntrl:]])/?/g; + return $cgi->span({-title=>$str}, esc_html($chopped)); } }