mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
News download: Fix handling of images with an ampersand in their URLs
This commit is contained in:
parent
a2a801bcdb
commit
d64119484b
@ -305,8 +305,6 @@ class RecursiveFetcher(object):
|
|||||||
iurl = tag['src']
|
iurl = tag['src']
|
||||||
if callable(self.image_url_processor):
|
if callable(self.image_url_processor):
|
||||||
iurl = self.image_url_processor(baseurl, iurl)
|
iurl = self.image_url_processor(baseurl, iurl)
|
||||||
ext = os.path.splitext(iurl)[1]
|
|
||||||
ext = ext[:5]
|
|
||||||
if not urlparse.urlsplit(iurl).scheme:
|
if not urlparse.urlsplit(iurl).scheme:
|
||||||
iurl = urlparse.urljoin(baseurl, iurl, False)
|
iurl = urlparse.urljoin(baseurl, iurl, False)
|
||||||
with self.imagemap_lock:
|
with self.imagemap_lock:
|
||||||
@ -319,7 +317,7 @@ class RecursiveFetcher(object):
|
|||||||
self.log.exception('Could not fetch image %s'% iurl)
|
self.log.exception('Could not fetch image %s'% iurl)
|
||||||
continue
|
continue
|
||||||
c += 1
|
c += 1
|
||||||
fname = ascii_filename('img'+str(c)+ext)
|
fname = ascii_filename('img'+str(c))
|
||||||
if isinstance(fname, unicode):
|
if isinstance(fname, unicode):
|
||||||
fname = fname.encode('ascii', 'replace')
|
fname = fname.encode('ascii', 'replace')
|
||||||
imgpath = os.path.join(diskpath, fname+'.jpg')
|
imgpath = os.path.join(diskpath, fname+'.jpg')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user