mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Output: Fix images that use URL unsafe characters in their filenames being dropped during conversion. Fixes #1873571 [remove pic when i chang ebook to docx](https://bugs.launchpad.net/calibre/+bug/1873571)
This commit is contained in:
parent
f27ca196d8
commit
63eea9fa35
@ -14,7 +14,7 @@ from polyglot.builtins import iteritems, itervalues, map, unicode_type
|
||||
from lxml import etree
|
||||
|
||||
from calibre import fit_image
|
||||
from calibre.ebooks.oeb.base import urlunquote
|
||||
from calibre.ebooks.oeb.base import urlunquote, urlquote
|
||||
from calibre.ebooks.docx.images import pt_to_emu
|
||||
from calibre.utils.filenames import ascii_filename
|
||||
from calibre.utils.imghdr import identify
|
||||
@ -50,8 +50,9 @@ class ImagesManager(object):
|
||||
|
||||
def read_image(self, href):
|
||||
if href not in self.images:
|
||||
item = self.oeb.manifest.hrefs.get(href)
|
||||
item = self.oeb.manifest.hrefs.get(href) or self.oeb.manifest.hrefs.get(urlquote(href))
|
||||
if item is None or not isinstance(item.data, bytes):
|
||||
self.log.warning('Failed to find image:', href)
|
||||
return
|
||||
try:
|
||||
fmt, width, height = identify(item.data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user