Fix regression in 0.8.36 that caused the remove format from book function to only delete the entry from the database and not delete the actual file from the disk

This commit is contained in:
Kovid Goyal 2012-01-21 18:51:03 +05:30
parent b9b2e386c8
commit c96112fada

View file

@ -1403,7 +1403,7 @@ def remove_format(self, index, format, index_is_id=False, notify=True,
id = index if index_is_id else self.id(index)
if not format: format = ''
self.format_metadata_cache[id].pop(format.upper(), None)
name = self.format_filename_cache[id].pop(format.upper(), None)
name = self.format_filename_cache[id].get(format.upper(), None)
if name:
if not db_only:
try:
@ -1412,6 +1412,7 @@ def remove_format(self, index, format, index_is_id=False, notify=True,
delete_file(path)
except:
traceback.print_exc()
self.format_filename_cache[id].pop(format.upper(), None)
self.conn.execute('DELETE FROM data WHERE book=? AND format=?', (id, format.upper()))
if commit:
self.conn.commit()