mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 03:16:22 -05:00
An author or subject beginning with a non-ASCII capital finds its collection (#902)
The lookup compared SQLite's lower(name), which folds only ASCII, with Python's str.lower(), which folds Unicode. "Édouard Hospitalier" never matched its own collection, so the doc modeler inserted a duplicate, hit the unique constraint, and re-extracted and failed on that doc on every modeler run. Both sides now use SQLite's lower(). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
56fee562b7
commit
44052741d3
2 changed files with 14 additions and 2 deletions
|
|
@ -210,7 +210,8 @@ def get_or_create_author_collection(session: Session, author_name: str) -> Optio
|
|||
|
||||
author_name = author_name.strip()
|
||||
collection = session.query(Collection).filter(
|
||||
func.lower(Collection.name) == author_name.lower(),
|
||||
# Both sides use SQLite's lower(), which folds only ASCII; Python's lower() would miss 'Édouard'.
|
||||
func.lower(Collection.name) == func.lower(author_name),
|
||||
Collection.kind == 'author',
|
||||
).first()
|
||||
if not collection:
|
||||
|
|
@ -228,7 +229,8 @@ def get_or_create_subject_collection(session: Session, subject_name: str) -> Opt
|
|||
|
||||
subject_name = subject_name.strip()
|
||||
collection = session.query(Collection).filter(
|
||||
func.lower(Collection.name) == subject_name.lower(),
|
||||
# Both sides use SQLite's lower(), which folds only ASCII; Python's lower() would miss 'Édouard'.
|
||||
func.lower(Collection.name) == func.lower(subject_name),
|
||||
Collection.kind == 'subject',
|
||||
).first()
|
||||
if not collection:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue