Patchwork D969: request: coerce content-type to native str

login
register
mail settings
Submitter phabricator
Date Oct. 8, 2017, 8:38 a.m.
Message ID <3229df2f3046044bf10b026b01c9e748@localhost.localdomain>
Download mbox | patch
Permalink /patch/24638/
State Not Applicable
Headers show

Comments

phabricator - Oct. 8, 2017, 8:38 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfc21a3513062: request: coerce content-type to native str (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D969?vs=2485&id=2530

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

AFFECTED FILES
  mercurial/hgweb/request.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -19,6 +19,7 @@ 
 )
 
 from .. import (
+    pycompat,
     util,
 )
 
@@ -89,6 +90,8 @@ 
             pass
 
     def respond(self, status, type, filename=None, body=None):
+        if not isinstance(type, str):
+            type = pycompat.sysstr(type)
         if self._start_response is not None:
             self.headers.append(('Content-Type', type))
             if filename: