Apply minified serialization to books inside collections

The GET /api/libraries/:id/collections endpoint captured the minified
flag on the response payload but never passed it down to the book
serialization, so each book was always returned fully expanded with its
complete libraryFiles array and heavy media fields (audioFiles, chapters,
tracks). For libraries with multi-file audiobooks this produced responses
of tens of megabytes even when minified=1 was requested.

Thread the minified flag through getOldCollectionsJsonExpanded and
Collection.toOldJSONExpanded so that, when requested, books use the
existing library item minified form. Non-minified requests are unchanged.

Fixes #5170
This commit is contained in:
Conor Bronsdon 2026-07-09 02:59:25 -07:00
parent 6f03467f35
commit 42c6798981
3 changed files with 117 additions and 5 deletions

View file

@ -830,7 +830,7 @@ class LibraryController {
}
// TODO: Create paginated queries
let collections = await Database.collectionModel.getOldCollectionsJsonExpanded(req.user, req.library.id, include)
let collections = await Database.collectionModel.getOldCollectionsJsonExpanded(req.user, req.library.id, include, payload.minified)
payload.total = collections.length