mirror of https://github.com/scrapy/scrapy.git
explicit close file on file:// scheme handler
This commit is contained in:
parent
c0d0734027
commit
d9b4850c44
|
|
@ -10,6 +10,7 @@ class FileDownloadHandler(object):
|
|||
@defers
|
||||
def download_request(self, request, spider):
|
||||
filepath = file_uri_to_path(request.url)
|
||||
body = open(filepath, 'rb').read()
|
||||
with open(filepath, 'rb') as fo:
|
||||
body = fo.read()
|
||||
respcls = responsetypes.from_args(filename=filepath, body=body)
|
||||
return respcls(url=request.url, body=body)
|
||||
|
|
|
|||
Loading…
Reference in New Issue