mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion: Fix incorrect relative URLs being generated when an HTML or CSS file is placed higher in the folder hierarchy than the opf file. Fixes #1474287 [ePUB->AZW3: incorrect styles on inline ToC](https://bugs.launchpad.net/calibre/+bug/1474287)
This commit is contained in:
parent
38028aa0d3
commit
30a2525d34
@ -1054,9 +1054,10 @@ class Manifest(object):
|
|||||||
return href
|
return href
|
||||||
if '/' not in self.href:
|
if '/' not in self.href:
|
||||||
return href
|
return href
|
||||||
base = os.path.dirname(self.href).split('/')
|
base = filter(None, os.path.dirname(os.path.normpath(self.href)).replace(os.sep, '/').split('/'))
|
||||||
target, frag = urldefrag(href)
|
target, frag = urldefrag(href)
|
||||||
target = target.split('/')
|
target = target.split('/')
|
||||||
|
index = 0
|
||||||
for index in xrange(min(len(base), len(target))):
|
for index in xrange(min(len(base), len(target))):
|
||||||
if base[index] != target[index]:
|
if base[index] != target[index]:
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user