mirror of
https://github.com/janeczku/calibre-web
synced 2026-10-18 05:42:26 +00:00
Handle NULL author_sort in order_authors
books.author_sort is nullable in Calibre's schema; a single book with a NULL value made every book list page return HTTP 500. Fall back to the unsorted author list instead of calling .split() on None. Fixes #3702 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a97826402f
commit
9fa67289fe
@@ -908,11 +908,13 @@ class CalibreDB:
|
||||
def order_authors(self, entries, list_return=False, combined=False):
|
||||
for entry in entries:
|
||||
if combined:
|
||||
sort_authors = entry.Books.author_sort.split('&')
|
||||
author_sort = entry.Books.author_sort
|
||||
authors_list = entry.Books.authors
|
||||
else:
|
||||
sort_authors = entry.author_sort.split('&')
|
||||
author_sort = entry.author_sort
|
||||
authors_list = entry.authors
|
||||
# author_sort is nullable in Calibre's schema, fall back to the unsorted author list
|
||||
sort_authors = author_sort.split('&') if author_sort else []
|
||||
|
||||
# Create dictionary for O(1) lookup instead of nested loops
|
||||
authors_by_sort = {}
|
||||
|
||||
Reference in New Issue
Block a user