From patchwork Sun Oct 15 04:57:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D1086: hgweb: mimetype guessing needs a unicode path From: phabricator X-Patchwork-Id: 24933 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 15 Oct 2017 04:57:50 +0000 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 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()