[PATCH 2 of 4] Don't send "Content-Type: none"

Alexis S. L. Carvalho alexis at cecm.usp.br
Thu Apr 20 05:42:29 UTC 2006


Thus spake Thomas Arendsen Hein:
> * Vadim Gelfer <vadim.gelfer at gmail.com> [20060419 20:55]:
> > On 4/15/06, Alexis S. L. Carvalho <alexis at cecm.usp.br> wrote:
> > 
> > > Don't send "Content-Type: none"
> > 
> > pushed to crew. thank you. are you sure is ok to use text/plain and
> > not application/octet-stream here?
> 
> Maybe we can use util.binary() to decide?

Now that you've mentioned it, it sounds like a pretty obvious thing to
do...

Alexis

# HG changeset patch
# User Alexis S. L. Carvalho <alexis at cecm.usp.br>
# Node ID 070c9bf044461080a36d408b34411f8b6c0db95b
# Parent  2b8f887b2d1d617443ad0085fa20ef3b2ed28cde
Use application/octet-stream as the content-type of unknown binary files

diff -r 2b8f887b2d1d -r 070c9bf04446 mercurial/hgweb.py
--- a/mercurial/hgweb.py	Wed Apr 19 21:39:51 2006 +0200
+++ b/mercurial/hgweb.py	Thu Apr 20 02:27:51 2006 -0300
@@ -419,7 +419,8 @@ class hgweb(object):
         mt = mimetypes.guess_type(f)[0]
         rawtext = text
         if util.binary(text):
-            text = "(binary:%s)" % (mt or 'data')
+            mt = mt or 'application/octet-stream'
+            text = "(binary:%s)" % mt
         mt = mt or 'text/plain'
 
         def lines():



More information about the Mercurial mailing list