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

Alexis S. L. Carvalho alexis at cecm.usp.br
Sun Apr 16 06:42:47 UTC 2006


# HG changeset patch
# User Alexis S. L. Carvalho <alexis at cecm.usp.br>
# Node ID d94182d58d21533f38a0225675d12ea5b314e2cf
# Parent  9a51cb57561017ff567cd9e73e87276839cafe95
Don't send "Content-Type: none"

mimetypes.guess_type will return (None, None) when it can't detect the
filetype.

diff -r 9a51cb575610 -r d94182d58d21 mercurial/hgweb.py
--- a/mercurial/hgweb.py	Sun Apr 16 03:37:17 2006 -0300
+++ b/mercurial/hgweb.py	Sun Apr 16 03:37:22 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
+            text = "(binary:%s)" % (mt or 'data')
+        mt = mt or 'text/plain'
 
         def lines():
             for l, t in enumerate(text.splitlines(1)):



More information about the Mercurial mailing list