comparison mercurial/hgweb/common.py @ 34721:baee5512f262

hgweb: mimetype guessing needs a unicode path Differential Revision: https://phab.mercurial-scm.org/D1086
author Augie Fackler <augie@google.com>
date Sat, 14 Oct 2017 10:47:29 -0400
parents f42dec9c976e
children 6ef744a7df65
comparison
equal deleted inserted replaced
34720:60e7da55e5e6 34721:baee5512f262
164 path = os.path.join(d, fpath) 164 path = os.path.join(d, fpath)
165 if os.path.exists(path): 165 if os.path.exists(path):
166 break 166 break
167 try: 167 try:
168 os.stat(path) 168 os.stat(path)
169 ct = mimetypes.guess_type(path)[0] or "text/plain" 169 ct = mimetypes.guess_type(pycompat.fsdecode(path))[0] or "text/plain"
170 with open(path, 'rb') as fh: 170 with open(path, 'rb') as fh:
171 data = fh.read() 171 data = fh.read()
172 172
173 req.respond(HTTP_OK, ct, body=data) 173 req.respond(HTTP_OK, ct, body=data)
174 except TypeError: 174 except TypeError: