Fix #1093 (epub conversion from mobi fails)

This commit is contained in:
Kovid Goyal 2008-09-29 11:54:33 -07:00
parent 4170d9125f
commit 80dad7f79a
2 changed files with 8 additions and 3 deletions

View File

@ -534,10 +534,15 @@ class OPF(object):
return self.guide_path(self.root)
def unquote_urls(self):
def get_href(item):
raw = unquote(item.get('href', ''))
if not isinstance(raw, unicode):
raw = raw.decode('utf-8')
return raw
for item in self.itermanifest():
item.set('href', unquote(item.get('href', '')))
item.set('href', get_href(item))
for item in self.iterguide():
item.set('href', unquote(item.get('href', '')))
item.set('href', get_href(item))
@apply
def authors():

View File

@ -160,7 +160,7 @@ class MobiReader(object):
self.book_header = BookHeader(self.sections[0][0], self.ident)
self.name = self.name.decode(self.book_header.codec, 'replace')
def extract_content(self, output_dir=os.getcwdu()):
output_dir = os.path.abspath(output_dir)