From e0e0714426bbf060e170c0d1face069c4524cc7e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Jun 2020 07:54:47 +0530 Subject: [PATCH] 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) --- src/calibre/ebooks/metadata/book/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py index 808639b630..ee8df68361 100644 --- a/src/calibre/ebooks/metadata/book/base.py +++ b/src/calibre/ebooks/metadata/book/base.py @@ -15,7 +15,7 @@ from calibre.ebooks.metadata.book import (SC_COPYABLE_FIELDS, 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 @@ class Metadata(object): 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']: