Fix catalog tags not being preserved

This commit is contained in:
Kovid Goyal 2023-11-14 21:45:26 +05:30
parent f9c7572b88
commit 4c68fafd41
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -268,8 +268,10 @@ def add_catalog(cache, path, title, dbapi=None):
db_id = cache._create_book_entry(mi, apply_import_tags=False) db_id = cache._create_book_entry(mi, apply_import_tags=False)
new_book_added = True new_book_added = True
else: else:
if not mi.tags or _('Catalog') not in mi.tags: tags = list(cache._field_for('tags', db_id) or ())
mi.tags.append(_('Catalog')) if _('Catalog') not in tags:
tags.append(_('Catalog'))
mi.tags = tags
cache._set_metadata(db_id, mi) cache._set_metadata(db_id, mi)
cache.add_format(db_id, fmt, stream, dbapi=dbapi) # Can't keep write lock since post-import hooks might run cache.add_format(db_id, fmt, stream, dbapi=dbapi) # Can't keep write lock since post-import hooks might run