diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index db5510d055..05a8887576 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -1485,7 +1485,7 @@ class DB(object): if not self.is_case_sensitive: for x in items: path_map[x.lower()] = x - items = set(path_map) + items = {x.lower() for x in items} paths = {x.lower() for x in paths} items = items.intersection(paths) return items, path_map diff --git a/src/calibre/db/tests/legacy.py b/src/calibre/db/tests/legacy.py index c936367ba4..55610f6401 100644 --- a/src/calibre/db/tests/legacy.py +++ b/src/calibre/db/tests/legacy.py @@ -167,7 +167,6 @@ class LegacyTest(BaseTest): for meth, args in { 'find_identical_books': [(Metadata('title one', ['author one']),), (Metadata('unknown'),), (Metadata('xxxx'),)], - 'get_top_level_move_items': [()], 'get_books_for_category': [('tags', newstag), ('#formats', 'FMT1')], 'get_next_series_num_for': [('A Series One',)], 'get_id_from_uuid':[('ddddd',), (db.uuid(1, True),)], @@ -241,6 +240,10 @@ class LegacyTest(BaseTest): for a in args: self.assertEqual(fmt(getattr(db, meth)(*a)), fmt(getattr(ndb, meth)(*a)), 'The method: %s() returned different results for argument %s' % (meth, a)) + def f(x, y): # get_top_level_move_items is broken in the old db on case-insensitive file systems + x.discard('metadata_db_prefs_backup.json') + return x, y + self.assertEqual(f(*db.get_top_level_move_items()), f(*ndb.get_top_level_move_items())) d1, d2 = BytesIO(), BytesIO() db.copy_cover_to(1, d1, True) ndb.copy_cover_to(1, d2, True)