The custom lower() SQL function registered in cps/db.py transliterates
author names via unidecode, so the case-insensitive lookup in
prepare_authors() also matched authors whose names are genuinely
different but collapse to the same ASCII string (accented vs. plain
Latin names, or Chinese homophones). The code then renamed that matched
author onto the freshly entered name, overwriting a distinct existing
author row and raising:
(sqlite3.IntegrityError) UNIQUE constraint failed: authors.name
Restrict the case-rename branch to matches that are equal ignoring case
only (casefold), so distinct authors are left untouched. Genuine
case-only renames (e.g. "stephen king" -> "Stephen King") still work.
Fixes#3403Fixes#3170
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>