comparison mercurial/hgweb/common.py @ 40211:d216ae4cc3f6

py3: r'' prefix default values for mimetypes.guess_mime() As suggested by @yuja in D4967. Differential Revision: https://phab.mercurial-scm.org/D5020
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 12 Oct 2018 19:49:02 +0200
parents 9310037f0636
children 8d9322b6e687
comparison
equal deleted inserted replaced
40210:8f192f2c4a1e 40211:d216ae4cc3f6
181 if os.path.exists(path): 181 if os.path.exists(path):
182 break 182 break
183 try: 183 try:
184 os.stat(path) 184 os.stat(path)
185 ct = pycompat.sysbytes( 185 ct = pycompat.sysbytes(
186 mimetypes.guess_type(pycompat.fsdecode(path))[0] or "text/plain") 186 mimetypes.guess_type(pycompat.fsdecode(path))[0] or r"text/plain")
187 with open(path, 'rb') as fh: 187 with open(path, 'rb') as fh:
188 data = fh.read() 188 data = fh.read()
189 189
190 res.headers['Content-Type'] = ct 190 res.headers['Content-Type'] = ct
191 res.setbodybytes(data) 191 res.setbodybytes(data)