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 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
id = index if index_is_id else self.id(index) id = index if index_is_id else self.id(index)
if not format: format = '' if not format: format = ''
self.format_metadata_cache[id].pop(format.upper(), None) 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 name:
if not db_only: if not db_only:
try: try:
@ -1412,6 +1412,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
delete_file(path) delete_file(path)
except: except:
traceback.print_exc() 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())) self.conn.execute('DELETE FROM data WHERE book=? AND format=?', (id, format.upper()))
if commit: if commit:
self.conn.commit() self.conn.commit()