mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
EPUB Output: Fix a bug that could cause corrupted output when doing an EPUB/OEB to EPUB conversion if the input EPUB had multiple files with the same name
This commit is contained in:
parent
1c091c9bd8
commit
c3f472e4ab
@ -105,14 +105,14 @@ class UniqueFilenames(object): # {{{
|
|||||||
base, ext = posixpath.splitext(item.href)
|
base, ext = posixpath.splitext(item.href)
|
||||||
nhref = base + suffix + ext
|
nhref = base + suffix + ext
|
||||||
nhref = oeb.manifest.generate(href=nhref)[1]
|
nhref = oeb.manifest.generate(href=nhref)[1]
|
||||||
|
spine_pos = item.spine_position
|
||||||
|
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.seen_filenames.add(posixpath.basename(nhref))
|
self.seen_filenames.add(posixpath.basename(nhref))
|
||||||
self.rename_map[item.href] = nhref
|
self.rename_map[item.href] = nhref
|
||||||
if item.spine_position is not None:
|
if spine_pos is not None:
|
||||||
oeb.spine.insert(item.spine_position, nitem, item.linear)
|
oeb.spine.insert(spine_pos, nitem, item.linear)
|
||||||
oeb.spine.remove(item)
|
|
||||||
oeb.manifest.remove(item)
|
|
||||||
else:
|
else:
|
||||||
self.seen_filenames.add(fname)
|
self.seen_filenames.add(fname)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user