From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org, kernel@pengutronix.de,
Stephen Boyd <bebarino@gmail.com>
Subject: Re: gitweb not friendly to firefox revived
Date: Thu, 12 Aug 2010 11:23:56 +0200 [thread overview]
Message-ID: <20100812092356.GC9763@pengutronix.de> (raw)
In-Reply-To: <201008032350.40117.jnareb@gmail.com>
Hello,
> Nevertheless it shows what's the problem. Somehow (perhaps wrong
> encoding, perhaps screw up with quoted-printable and git-am, perhaps
> copy'n' paste included ANSII color codes from terminal, perhaps something
> different altogether) you got control characters (\e = ESC) in $author.
> In strict XHTML mode (with 'application/xml
>
> Please try the following patch
>
> -- >8 --
> From: Jakub Narebski <jnareb@gmail.com>
> Subject: [PATCH] gitweb: Harden format_search_author()
>
> Protect format_search_author against control characters in $author.
> While at it simplify it a bit, and use spaces for align.
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> gitweb/gitweb.perl | 29 ++++++++++++++---------------
> 1 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 8b02767..ea9c09c 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1856,23 +1856,22 @@ sub format_search_author {
> my ($author, $searchtype, $displaytext) = @_;
> my $have_search = gitweb_check_feature('search');
>
> - if ($have_search) {
> - my $performed = "";
> - if ($searchtype eq 'author') {
> - $performed = "authored";
> - } elsif ($searchtype eq 'committer') {
> - $performed = "committed";
> - }
> -
> - return $cgi->a({-href => href(action=>"search", hash=>$hash,
> - searchtext=>$author,
> - searchtype=>$searchtype), class=>"list",
> - title=>"Search for commits $performed by $author"},
> - $displaytext);
> + return $displaytext unless ($have_search);
>
> - } else {
> - return $displaytext;
> + my $performed = "";
> + if ($searchtype eq 'author') {
> + $performed = "authored";
> + } elsif ($searchtype eq 'committer') {
> + $performed = "committed";
> }
> +
> + my $title = to_utf8("Search for commits $performed by $author");
> + $title =~ s/[[:cntrl:]]/?/g;
> +
> + return $cgi->a({-href => href(action=>"search", hash=>$hash,
> + searchtext=>$author, searchtype=>$searchtype),
> + -class=>"list", -title=>$title},
> + $displaytext);
> }
Seems to do the right thing. With Firefox I get a correct listing now
instead of the xml parse error.
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2010-08-12 9:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-01 19:51 gitweb not friendly to firefox revived Uwe Kleine-König
2010-08-01 20:15 ` Ævar Arnfjörð Bjarmason
2010-08-02 5:31 ` Uwe Kleine-König
2010-08-01 20:26 ` Jakub Narebski
2010-08-03 21:07 ` Uwe Kleine-König
2010-08-03 21:50 ` Jakub Narebski
2010-08-12 9:23 ` Uwe Kleine-König [this message]
2010-08-14 10:33 ` Stephen Boyd
2010-08-14 10:48 ` Ævar Arnfjörð Bjarmason
2010-08-14 12:33 ` Jakub Narebski
2010-09-07 8:22 ` Uwe Kleine-König
2010-08-14 12:29 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100812092356.GC9763@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=kernel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).