Fix delete_item calling get_filepath after extract from manifest.

This commit is contained in:
Ethan Dalool 2020-08-26 17:58:10 -07:00
parent 8c888353e5
commit b561a3233f

View file

@ -617,11 +617,13 @@ class Epub:
@writes
def delete_file(self, id):
manifest_item = self.opf.manifest.find('item', {'id': id})
filepath = self.get_filepath(id)
manifest_item.extract()
spine_item = self.opf.spine.find('itemref', {'idref': id})
if spine_item:
spine_item.extract()
os.remove(self.get_filepath(id).absolute_path)
os.remove(filepath.absolute_path)
def get_filepath(self, id):
href = self.opf.manifest.find('item', {'id': id})['href']