D965: templatefilters: be sure we always feed cgi.escape a str

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu Oct 5 21:32:03 UTC 2017


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D965

AFFECTED FILES
  mercurial/templatefilters.py

CHANGE DETAILS

diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -128,7 +128,8 @@
     """Any text. Replaces the special XML/XHTML characters "&", "<"
     and ">" with XML entities, and filters out NUL characters.
     """
-    return cgi.escape(text.replace('\0', ''), True)
+    return pycompat.sysbytes(
+        cgi.escape(pycompat.sysstr(text.replace('\0', '')), True))
 
 para_re = None
 space_re = None



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list