Closed JoeJasinski closed 8 years ago
I also viewed this bug while requesting files from MEDIA_URL with DEBUG=True. It looks like you need to add additional check for existence 'Content-Type' in response (htmlmin/middleware.py:32).
released in 0.9.1 :)
Hi,
When the content-type is not available in the response, the following exception is raised. I encounter this error when serving up static media with django-filer, but it looks like this could happen in any case where the request['Content-Type'] is not present.
` Environment:
Request Method: GET Request URL: http://localhost:8000/media/filer_public/df/66/df664fc4-d8a6-4d88-8aef-7be5e3aef32a/chipy-05-chicago_flag_python_logo-01.jpg
Django Version: 1.9.4 Python Version: 2.7.9 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sitemaps', 'djangocms_admin_style', 'django.contrib.admin', 'easy_thumbnails', 'mptt', 'filer', 'nocaptcha_recaptcha', 'cms', 'treebeard', 'menus', 'sekizai', 'reversion', 'sorl.thumbnail', 'django_extensions', 'pagefeature', 'contact_form', 'photo_gallery.apps.PhotoConfig', 'djangocms_inherit', 'djangocms_teaser', 'djangocms_link', 'djangocms_snippet', 'djangocms_text_ckeditor', 'djangocms_plain_text') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'htmlmin.middleware.HtmlMinifyMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware', 'htmlmin.middleware.MarkRequestMiddleware')Traceback:
File "/Users/jjasinski/Sites/joejasinski/envs/joejasinski/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
File "/mysite/mysite/envs/mysite/lib/python2.7/site-packages/htmlmin/middleware.py" in process_response
File "/mysite/envs/mysite/lib/python2.7/site-packages/htmlmin/middleware.py" in can_minify_response
File "/mysite/envs/mysite/lib/python2.7/site-packages/django/http/response.py" in getitem
Exception Type: KeyError at /media/filer_public/df/66/df664fc4-d8a6-4d88-8aef-7be5e3aef32a/chipy-05-chicago_flag_python_logo-01.jpg Exception Value: 'content-type' `