From: David Symonds <dsymonds@gmail.com>
To: pasky@ucw.cz
Cc: git@vger.kernel.org, David Symonds <dsymonds@gmail.com>
Subject: [PATCH] Prevent purely-numeric ref names from breaking Javascript.
Date: Tue, 2 Oct 2007 01:37:02 +1000 [thread overview]
Message-ID: <11912530222348-git-send-email-dsymonds@gmail.com> (raw)
When the server reply carrying JSON data to the client browser to render has
a string that looks like a decimal number, it doesn't get quoted. The
client-side Javascript code assumes, however, that all the ref names are
strings, and so calls string functions on decimal number objects if the ref
name is purely numeric (e.g. "2.5"). This patch simply forces the objects that
are escaped for HTML presentation to be coerced into strings, which catches
this case (and possibly others).
---
by-commit.html | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/by-commit.html b/by-commit.html
index d759c3e..0aa69b9 100644
--- a/by-commit.html
+++ b/by-commit.html
@@ -35,6 +35,7 @@ format_log_date=function( date )
}
escape_html=function( s )
{
+ s=s+""; // ensure it's a string
s=s.replace( /\&/g, "&" );
s=s.replace( /\</g, "<" );
s=s.replace( /\>/g, ">" );
--
1.5.3.1
reply other threads:[~2007-10-01 15:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=11912530222348-git-send-email-dsymonds@gmail.com \
--to=dsymonds@gmail.com \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
/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).