git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Prevent purely-numeric ref names from breaking Javascript.
@ 2007-10-01 15:37 David Symonds
  0 siblings, 0 replies; only message in thread
From: David Symonds @ 2007-10-01 15:37 UTC (permalink / raw)
  To: pasky; +Cc: git, David Symonds

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, "&lt;" );
 	s=s.replace( /\>/g, "&gt;" );
-- 
1.5.3.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-01 15:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-01 15:37 [PATCH] Prevent purely-numeric ref names from breaking Javascript David Symonds

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).