Mercurial > hg-stable
changeset 6981:029a54423a96
hgweb: Serve raw non-binary files as text/plain
Previously these were served as application/octet-stream usually making
browsers download them as files though they can be displayed inline just
fine. This is useful to refer to e.g. /project/raw-file/tip/README.
author | Rocco Rutte <pdmef@gmx.net> |
---|---|
date | Wed, 03 Sep 2008 15:46:46 +0200 |
parents | 2268edff1bec |
children | 6c4a08270222 5cf3bf3c19ba |
files | mercurial/hgweb/webcommands.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Wed Sep 03 02:27:25 2008 +0200 +++ b/mercurial/hgweb/webcommands.py Wed Sep 03 15:46:46 2008 +0200 @@ -50,8 +50,8 @@ path = fctx.path() text = fctx.data() mt = mimetypes.guess_type(path)[0] - if mt is None or binary(text): - mt = mt or 'application/octet-stream' + if mt is None: + mt = binary(text) and 'application/octet-stream' or 'text/plain' req.respond(HTTP_OK, mt, path, len(text)) return [text]