Conversion: Fix remove first image option not working for comic input with the disable comic processing option. Fixes #1709150 [CBZ > EPUB "remove first image" issue](https://bugs.launchpad.net/calibre/+bug/1709150)

This commit is contained in:
Kovid Goyal 2017-08-09 10:07:42 +05:30
parent 20a01d93df
commit 6f0c724dad
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -15,7 +15,7 @@ from lxml import etree
from calibre import guess_type, strftime
from calibre.constants import iswindows
from calibre.ebooks.BeautifulSoup import BeautifulSoup
from calibre.ebooks.oeb.base import XPath, XHTML_NS, XHTML, xml2text, urldefrag
from calibre.ebooks.oeb.base import XPath, XHTML_NS, XHTML, xml2text, urldefrag, urlnormalize
from calibre.library.comments import comments_to_html
from calibre.utils.date import is_date_undefined, as_local_time
from calibre.utils.icu import sort_key
@ -43,7 +43,10 @@ class Base(object):
if removed >= limit:
break
href = item.abshref(img.get('src'))
image = self.oeb.manifest.hrefs.get(href, None)
image = self.oeb.manifest.hrefs.get(href)
if image is None:
href = urlnormalize(href)
image = self.oeb.manifest.hrefs.get(href)
if image is not None:
self.oeb.manifest.remove(image)
self.oeb.guide.remove_by_href(href)