mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Output: Fix the Flatten filenames option in EPUB Output causing duplicated manifest ids in rare cases. Fixes #905692 (mobi to epub conversions with large tocs create corrupted epubs)
This commit is contained in:
parent
e8e4246860
commit
2de126e308
@ -159,15 +159,18 @@ class FlatFilenames(object): # {{{
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
data = item.data
|
data = item.data
|
||||||
|
isp = item.spine_position
|
||||||
nhref = oeb.manifest.generate(href=nhref)[1]
|
nhref = oeb.manifest.generate(href=nhref)[1]
|
||||||
|
if isp is not None:
|
||||||
|
oeb.spine.remove(item)
|
||||||
|
oeb.manifest.remove(item)
|
||||||
|
|
||||||
nitem = oeb.manifest.add(item.id, nhref, item.media_type, data=data,
|
nitem = oeb.manifest.add(item.id, nhref, item.media_type, data=data,
|
||||||
fallback=item.fallback)
|
fallback=item.fallback)
|
||||||
self.rename_map[item.href] = nhref
|
self.rename_map[item.href] = nhref
|
||||||
self.renamed_items_map[nhref] = item
|
self.renamed_items_map[nhref] = item
|
||||||
if item.spine_position is not None:
|
if isp is not None:
|
||||||
oeb.spine.insert(item.spine_position, nitem, item.linear)
|
oeb.spine.insert(isp, nitem, item.linear)
|
||||||
oeb.spine.remove(item)
|
|
||||||
oeb.manifest.remove(item)
|
|
||||||
|
|
||||||
if self.rename_map:
|
if self.rename_map:
|
||||||
self.log('Found non-flat filenames, renaming to support broken'
|
self.log('Found non-flat filenames, renaming to support broken'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user