From 1dcaca583bd49cad1472fe6b76b9c0c2fa5fa27c Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sun, 7 Feb 2010 03:28:05 -0500 Subject: [PATCH] mimetype.guess_type() returns a tuple, and it might be (None, None). --- httpserver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/httpserver.py b/httpserver.py index 5db37ca..4c7e1ab 100644 --- a/httpserver.py +++ b/httpserver.py @@ -189,8 +189,10 @@ class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): raise # Send the header + mime = mimetypes.guess_type(filen)[0] self.send_response(200) - self.send_header('Content-type', mimetypes.guess_type(filen)) + if mime: + self.send_header('Content-type', mime) self.send_header('Content-length', os.path.getsize(filen)) self.end_headers() -- 2.11.4.GIT