Skip to content

Commit

Permalink
Do not silently fail on gzip unzipping
Browse files Browse the repository at this point in the history
  • Loading branch information
redapple committed Mar 7, 2017
1 parent 11cdf58 commit b174744
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scrapy/downloadermiddlewares/httpcompression.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import zlib

from scrapy.utils.gz import gunzip, is_gzipped
from scrapy.utils.gz import gunzip
from scrapy.http import Response, TextResponse
from scrapy.responsetypes import responsetypes
from scrapy.exceptions import NotConfigured
Expand Down
5 changes: 1 addition & 4 deletions scrapy/spiders/sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ def _get_sitemap_body(self, response):
if isinstance(response, XmlResponse):
return response.body
elif gzip_magic_number(response):
try:
return gunzip(response.body)
except:
pass
return gunzip(response.body)
# actual gzipped sitemap files are decompressed above ;
# if we are here (response body is not gzipped)
# and have a response for .xml.gz,
Expand Down

0 comments on commit b174744

Please sign in to comment.