When getting identifiers for a book use a copy of the dict

Fixes #1945098 [5.28 Forgets or reverts identifiers](https://bugs.launchpad.net/calibre/+bug/1945098)
This commit is contained in:
Kovid Goyal 2021-09-26 20:07:49 +05:30
parent 32e9dc32b2
commit 5bf68b5971
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -577,8 +577,10 @@ class ManyToManyField(Field):
class IdentifiersField(ManyToManyField):
def for_book(self, book_id, default_value=None):
ids = self.table.book_col_map.get(book_id, ())
if not ids:
ids = self.table.book_col_map.get(book_id, None)
if ids:
ids = ids.copy()
else:
try:
ids = default_value.copy() # in case default_value is a mutable dict
except AttributeError: