mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
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:
parent
212a2df4d1
commit
071b97a0de
@ -6,10 +6,12 @@ class Recipe(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_download_filename_from_response(response):
|
def get_download_filename_from_response(response):
|
||||||
|
from urlparse import urlparse
|
||||||
from urllib2 import unquote as urllib2_unquote
|
from urllib2 import unquote as urllib2_unquote
|
||||||
filename = last_part_name = ''
|
filename = last_part_name = ''
|
||||||
try:
|
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', '')
|
disposition = response.info().get('Content-disposition', '')
|
||||||
for p in disposition.split(';'):
|
for p in disposition.split(';'):
|
||||||
if 'filename' in p:
|
if 'filename' in p:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user