Fix downloading ebooks from Project Gutenberg via the builtin browser not working because of changes to the Project Gutenberg website. Fixes #1366240 [EPUB download from Project Gutenberg not recognized, errors copying to itself](https://bugs.launchpad.net/calibre/+bug/1366240)

This commit is contained in:
Kovid Goyal 2014-09-06 10:17:01 +05:30
parent 212a2df4d1
commit 071b97a0de

View File

@ -6,10 +6,12 @@ class Recipe(object):
pass
def get_download_filename_from_response(response):
from urlparse import urlparse
from urllib2 import unquote as urllib2_unquote
filename = last_part_name = ''
try:
last_part_name = response.geturl().split('/')[-1]
purl = urlparse(response.geturl())
last_part_name = purl.path.split('/')[-1]
disposition = response.info().get('Content-disposition', '')
for p in disposition.split(';'):
if 'filename' in p: