mirror of
https://github.com/wassname/FanFicFare.git
synced 2026-09-10 11:40:24 +08:00
Fix for pre-existing epubs with stripped img tags.
This commit is contained in:
@@ -284,8 +284,10 @@ class BaseSiteAdapter(Configurable):
|
||||
if self.getConfig('include_images'):
|
||||
acceptable_attributes.extend(('src','alt','longdesc'))
|
||||
for img in soup.findAll('img'):
|
||||
img['longdesc']=img['src']
|
||||
img['src']=self.story.addImgUrl(self,url,img['src'],fetch)
|
||||
# some pre-existing epubs have img tags that had src stripped off.
|
||||
if 'src' in img:
|
||||
img['longdesc']=img['src']
|
||||
img['src']=self.story.addImgUrl(self,url,img['src'],fetch)
|
||||
|
||||
for attr in soup._getAttrMap().keys():
|
||||
if attr not in acceptable_attributes:
|
||||
|
||||
@@ -56,6 +56,8 @@ def get_update_data(inputio,
|
||||
if getsoups:
|
||||
soup = bs.BeautifulSoup(epub.read(href).decode("utf-8"))
|
||||
for img in soup.findAll('img'):
|
||||
newsrc=''
|
||||
longdesc=''
|
||||
try:
|
||||
newsrc=get_path_part(href)+img['src']
|
||||
# remove all .. and the path part above it, if present.
|
||||
|
||||
Reference in New Issue
Block a user