Don't add unchanged paths to the rename_map.

This commit is contained in:
Ethan Dalool 2019-08-18 22:39:02 -07:00
parent 87f1de1dc5
commit 34ce1bac56

View file

@ -877,6 +877,7 @@ class Epub:
os.makedirs(directory.absolute_path, exist_ok=True) os.makedirs(directory.absolute_path, exist_ok=True)
new_filepath = directory.with_child(old_filepath.basename) new_filepath = directory.with_child(old_filepath.basename)
if new_filepath != old_filepath:
rename_map[old_filepath] = new_filepath rename_map[old_filepath] = new_filepath
os.rename(old_filepath.absolute_path, new_filepath.absolute_path) os.rename(old_filepath.absolute_path, new_filepath.absolute_path)
manifest_item['href'] = new_filepath.relative_to(self.opf_filepath.parent, simple=True) manifest_item['href'] = new_filepath.relative_to(self.opf_filepath.parent, simple=True)