Compare commits

...

2 Commits

Author SHA1 Message Date
pictuga 56e0c2391d Missing import for served files 2020-08-28 20:53:03 +02:00
pictuga 679f406a12 Default mimetype for served files 2020-08-28 20:52:43 +02:00
1 changed files with 3 additions and 1 deletions

View File

@ -21,6 +21,8 @@ import re
import lxml.etree
import cgitb
import wsgiref.util
import mimetypes
try:
# python 2
@ -180,7 +182,7 @@ def cgi_file_handler(environ, start_response, app):
# file successfully open
headers = {}
headers['status'] = '200 OK'
headers['content-type'] = mimetypes.guess_type(path)[0]
headers['content-type'] = mimetypes.guess_type(path)[0] or 'application/octet-stream'
start_response(headers['status'], list(headers.items()))
return wsgiref.util.FileWrapper(f)