Skip to content

Commit

Permalink
Added content-type check as per issue scrapy#193
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Vereecken authored and chekunkov committed Apr 26, 2014
1 parent a2dd1ff commit df33d4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scrapy/contrib/downloadermiddleware/httpcompression.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import zlib

from scrapy.utils.gz import gunzip
from scrapy.utils.gz import gunzip, is_gzipped
from scrapy.http import Response, TextResponse
from scrapy.responsetypes import responsetypes
from scrapy.exceptions import NotConfigured
Expand All @@ -22,7 +22,7 @@ def process_request(self, request, spider):
def process_response(self, request, response, spider):
if isinstance(response, Response):
content_encoding = response.headers.getlist('Content-Encoding')
if content_encoding:
if content_encoding and not is_gzipped(response):
encoding = content_encoding.pop()
decoded_body = self._decode(response.body, encoding.lower())
respcls = responsetypes.from_args(headers=response.headers, \
Expand Down

0 comments on commit df33d4a

Please sign in to comment.