mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-24 01:33:39 +01:00
Fix for pre-existing epubs with stripped img tags.
This commit is contained in:
parent
3bb26c2b58
commit
0917460e68
2 changed files with 6 additions and 2 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue