mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
newdb: Fix setting author names with | in them
Fixes #1220348 [Vertical bar "|" in author name causes ConstraintError](https://bugs.launchpad.net/calibre/+bug/1220348)
This commit is contained in:
parent
cca7c89f24
commit
db195e6b75
@ -297,6 +297,11 @@ class WritingTest(BaseTest):
|
||||
ae(sf('tags', {3: ('x', 'X')}), {3}, 'Failed when setting tag twice with different cases')
|
||||
ae(('x',), cache.field_for('tags', 3))
|
||||
|
||||
# Test setting of authors with | in their names (for legacy database
|
||||
# format compatibility | is replaced by ,)
|
||||
ae(sf('authors', {3: ('Some| Author',)}), {3})
|
||||
ae(('Some, Author',), cache.field_for('authors', 3))
|
||||
|
||||
# }}}
|
||||
|
||||
def test_dirtied(self): # {{{
|
||||
|
@ -156,7 +156,7 @@ def get_adapter(name, metadata):
|
||||
if name == 'author_sort':
|
||||
return lambda x: ans(x) or ''
|
||||
if name == 'authors':
|
||||
return lambda x: ans(x) or (_('Unknown'),)
|
||||
return lambda x: tuple(y.replace('|', ',') for y in ans(x)) or (_('Unknown'),)
|
||||
if name in {'timestamp', 'last_modified'}:
|
||||
return lambda x: ans(x) or UNDEFINED_DATE
|
||||
if name == 'series_index':
|
||||
|
Loading…
x
Reference in New Issue
Block a user