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

2017-10-08 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I also popped https://phab.mercurial-scm.org/D964 out of the stack until I 
can address review feedback. :)

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, pulkit, indygreg, yuja
Cc: yuja, indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2017-10-08 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  Bleh. I missed yuya's comment before doing a delayed push. Feel free to drop 
this from hg-committed or address as a follow-up.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, pulkit, indygreg, yuja
Cc: yuja, indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2017-10-08 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4296bbb19410: templatefilters: be sure we always feed 
cgi.escape a str (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D965?vs=2481=2527

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, pulkit, indygreg, yuja
Cc: yuja, indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2017-10-06 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  sysstr -> sysbytes can't be round-trip if non-ascii characters are involved.
  
  Perhaps we can just vendor cgi.escape() and add b'' to every string.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, pulkit, indygreg, yuja
Cc: yuja, indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2017-10-05 Thread pulkit (Pulkit Goyal)
pulkit accepted this revision.
pulkit added a comment.


  Checked docs and made sure `cgi.escape` on Python 3 accepts str only.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2017-10-05 Thread durin42 (Augie Fackler)
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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel