Fix #1982651 [Details pane: Clicking on enumerated item with ampersand produces incorrect search](https://bugs.launchpad.net/calibre/+bug/1982651)

This commit is contained in:
Kovid Goyal 2022-07-26 15:32:56 +05:30
parent 9aae5f8b29
commit c8059f3cd1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -257,7 +257,7 @@ def mi_to_html(
val = mi.format_field(field)[-1] val = mi.format_field(field)[-1]
ans.append((field, row % (name, val))) ans.append((field, row % (name, val)))
else: else:
val = mi.format_field(field)[-1] val = unescaped_val = mi.format_field(field)[-1]
if val is None: if val is None:
continue continue
val = p(val) val = p(val)
@ -311,8 +311,8 @@ def mi_to_html(
except Exception: except Exception:
st = field st = field
val = '<a href="{}" title="{}">{}</a>'.format( val = '<a href="{}" title="{}">{}</a>'.format(
search_action_with_data(st, val, book_id, field), a( search_action_with_data(st, unescaped_val, book_id, field), a(
_('Click to see books with {0}: {1}').format(metadata['name'] or field, val)), p(val)) _('Click to see books with {0}: {1}').format(metadata['name'] or field, val)), val)
elif metadata['datatype'] == 'bool': elif metadata['datatype'] == 'bool':
val = '<a href="{}" title="{}">{}</a>'.format( val = '<a href="{}" title="{}">{}</a>'.format(
search_action_with_data(field, val, book_id, None), a( search_action_with_data(field, val, book_id, None), a(