diff mercurial/templatefilters.py @ 17772:823a7d79ef82

hgweb: make the escape filter remove null characters (issue2567)
author Siddharth Agarwal <sid0@fb.com>
date Mon, 15 Oct 2012 09:43:34 -0700
parents bededd3f0735
children 4e949b8e0930 a5d33446e46c
line wrap: on
line diff
--- a/mercurial/templatefilters.py	Tue Oct 16 16:56:14 2012 +0200
+++ b/mercurial/templatefilters.py	Mon Oct 15 09:43:34 2012 -0700
@@ -92,9 +92,9 @@
 
 def escape(text):
     """:escape: Any text. Replaces the special XML/XHTML characters "&", "<"
-    and ">" with XML entities.
+    and ">" with XML entities, and filters out NUL characters.
     """
-    return cgi.escape(text, True)
+    return cgi.escape(text.replace('\0', ''), True)
 
 para_re = None
 space_re = None