mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Book: Check Book: Fix automatic correction of invalid ids not working for ids in the OPF file. Fixes #1479462 [Check Book repair function has unexpected file remove side-effect](https://bugs.launchpad.net/calibre/+bug/1479462)
This commit is contained in:
parent
0715c663f9
commit
955d040745
@ -129,6 +129,14 @@ def replace_ids(container, id_map):
|
||||
for name, media_type in container.mime_map.iteritems():
|
||||
repl = IdReplacer(name, container, id_map)
|
||||
container.replace_links(name, repl)
|
||||
if name == container.opf_name:
|
||||
imap = id_map.get(name, {})
|
||||
for item in container.opf_xpath('//*[@idref]'):
|
||||
old_id = item.get('idref')
|
||||
if old_id is not None:
|
||||
new_id = imap.get(old_id)
|
||||
if new_id is not None:
|
||||
item.set('idref', new_id)
|
||||
if repl.replaced:
|
||||
changed = True
|
||||
return changed
|
||||
|
Loading…
x
Reference in New Issue
Block a user