From c96112fadadefed25e6ffff8b14a3f24968128b7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 21 Jan 2012 18:51:03 +0530 Subject: [PATCH] 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 --- src/calibre/library/database2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index f178ff7c6a..ff99beb384 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1403,7 +1403,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): 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 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): 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()