When merging metadata objects, if a custom column has type multiple in the new data and some other type in the old data, ignore the old data instead of erroring out. Fixes #1881796 [Private bug](https://bugs.launchpad.net/calibre/+bug/1881796)

This commit is contained in:
Kovid Goyal 2020-06-04 07:54:47 +05:30
parent 0ce941104d
commit e0e0714426
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -15,7 +15,7 @@
TOP_LEVEL_IDENTIFIERS, ALL_METADATA_FIELDS)
from calibre.library.field_metadata import FieldMetadata
from calibre.utils.icu import sort_key
from polyglot.builtins import iteritems, unicode_type, filter, map
from polyglot.builtins import iteritems, unicode_type, filter, map, string_or_bytes
# Special sets used to optimize the performance of getting and setting
# attributes on Metadata objects
@ -544,6 +544,8 @@ def copy_not_none(dest, src, attr):
meta = other.get_user_metadata(x, make_copy=True)
if meta is not None:
self_tags = self.get(x, [])
if isinstance(self_tags, string_or_bytes):
self_tags = []
self.set_user_metadata(x, meta) # get... did the deepcopy
other_tags = other.get(x, [])
if meta['datatype'] == 'text' and meta['is_multiple']: