# HG changeset patch # User Rocco Rutte # Date 2008-09-03 13:46:46 # Node ID 029a54423a96d82e301df8f389b69ce01d064ac0 # Parent 2268edff1bec20c1f3ee4bdee43275a216287bc8 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. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -50,8 +50,8 @@ def rawfile(web, req, tmpl): 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]