Patchwork D1086: hgweb: mimetype guessing needs a unicode path

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2017, 4:57 a.m.
Message ID <differential-rev-PHID-DREV-f5qcwpzajbqzygd6xvcl-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24933/
State Superseded
Headers show

Comments

phabricator - Oct. 15, 2017, 4:57 a.m.
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/D1086

AFFECTED FILES
  mercurial/hgweb/common.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -166,7 +166,7 @@ 
             break
     try:
         os.stat(path)
-        ct = mimetypes.guess_type(path)[0] or "text/plain"
+        ct = mimetypes.guess_type(pycompat.fsdecode(path))[0] or "text/plain"
         with open(path, 'rb') as fh:
             data = fh.read()