##// END OF EJS Templates
hgweb: specify a charset when sending raw text files...
Julian Cowley -
r11332:716e176a default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 import os, mimetypes, re, cgi, copy
8 import os, mimetypes, re, cgi, copy
9 import webutil
9 import webutil
10 from mercurial import error, archival, templater, templatefilters
10 from mercurial import error, encoding, archival, templater, templatefilters
11 from mercurial.node import short, hex
11 from mercurial.node import short, hex
12 from mercurial.util import binary
12 from mercurial.util import binary
13 from common import paritygen, staticfile, get_contact, ErrorResponse
13 from common import paritygen, staticfile, get_contact, ErrorResponse
@@ -51,6 +51,8 b' def rawfile(web, req, tmpl):'
51 mt = mimetypes.guess_type(path)[0]
51 mt = mimetypes.guess_type(path)[0]
52 if mt is None:
52 if mt is None:
53 mt = binary(text) and 'application/octet-stream' or 'text/plain'
53 mt = binary(text) and 'application/octet-stream' or 'text/plain'
54 if mt.startswith('text/'):
55 mt += '; charset="%s"' % encoding.encoding
54
56
55 req.respond(HTTP_OK, mt, path, len(text))
57 req.respond(HTTP_OK, mt, path, len(text))
56 return [text]
58 return [text]
General Comments 0
You need to be logged in to leave comments. Login now