Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #5313 -- Only avoid compressing Javascript when the user agent …

…says it's Internet Explorer. Thanks,

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c4cdb214a6a597bfd6fae6f855303b199b3d208d 1 parent b6ec8d3
@malcolmt malcolmt authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 django/middleware/
7 django/middleware/
@@ -17,10 +17,11 @@ def process_response(self, request, response):
return response
patch_vary_headers(response, ('Accept-Encoding',))
# Avoid gzipping if we've already got a content-encoding or if the
- # content-type is Javascript (silly IE...)
- is_js = "javascript" in response.get('Content-Type', '').lower()
+ # content-type is Javascript and the user's browser is IE.
+ is_js = ("msie" in request.META.get('HTTP_USER_AGENT', '').lower() and
+ "javascript" in response.get('Content-Type', '').lower())
if response.has_header('Content-Encoding') or is_js:
return response
Please sign in to comment.
Something went wrong with that request. Please try again.