Fix delete_item calling get_filepath after extract from manifest.
This commit is contained in:
parent
8c888353e5
commit
b561a3233f
1 changed files with 3 additions and 1 deletions
|
@ -617,11 +617,13 @@ class Epub:
|
||||||
@writes
|
@writes
|
||||||
def delete_file(self, id):
|
def delete_file(self, id):
|
||||||
manifest_item = self.opf.manifest.find('item', {'id': id})
|
manifest_item = self.opf.manifest.find('item', {'id': id})
|
||||||
|
filepath = self.get_filepath(id)
|
||||||
|
|
||||||
manifest_item.extract()
|
manifest_item.extract()
|
||||||
spine_item = self.opf.spine.find('itemref', {'idref': id})
|
spine_item = self.opf.spine.find('itemref', {'idref': id})
|
||||||
if spine_item:
|
if spine_item:
|
||||||
spine_item.extract()
|
spine_item.extract()
|
||||||
os.remove(self.get_filepath(id).absolute_path)
|
os.remove(filepath.absolute_path)
|
||||||
|
|
||||||
def get_filepath(self, id):
|
def get_filepath(self, id):
|
||||||
href = self.opf.manifest.find('item', {'id': id})['href']
|
href = self.opf.manifest.find('item', {'id': id})['href']
|
||||||
|
|
Loading…
Reference in a new issue