Offline book downloads don't persist the cover — downloaded books show broken covers once the presigned URL expires #880

Closed
opened 2026-07-28 01:59:36 +00:00 by spikerj · 0 comments
Owner

Problem

The offline pipeline stores the book body but not the cover:

  • book-offline-store.service.ts has IndexedDB stores for PDF blobs, EPUB pages, and EPUB resources — no cover store.
  • book-offline-download.service.ts downloads the PDF/EPUB body and inline epub resources, never the cover.

Covers render from short-lived presigned MinIO URLs (coverUrl / coverVariants[].url, ~1–2h TTL). So a book downloaded for offline reading shows a broken cover on the shelf as soon as the URL expires / the device goes offline — precisely the situation offline download exists for.

Fix

  1. During offline download, fetch one cover rendition (largest coverVariants entry, else coverUrl) as a blob and persist it in a new IndexedDB covers store keyed by book id (schema version bump).
  2. On the shelf (my-books-shelf), prefer the stored cover blob (object URL) for books that are downloaded; fall back to the presigned URL otherwise.
  3. Delete the stored cover when the offline copy is removed.

Related: #879 (SW dead-URL fallback), reader/Kavita-parity offline workstream (PR-8), spikersoft-backend#499.

## Problem The offline pipeline stores the book **body** but not the cover: - `book-offline-store.service.ts` has IndexedDB stores for PDF blobs, EPUB pages, and EPUB resources — no cover store. - `book-offline-download.service.ts` downloads the PDF/EPUB body and inline epub resources, never the cover. Covers render from short-lived presigned MinIO URLs (`coverUrl` / `coverVariants[].url`, ~1–2h TTL). So a book downloaded for offline reading shows a **broken cover** on the shelf as soon as the URL expires / the device goes offline — precisely the situation offline download exists for. ## Fix 1. During offline download, fetch one cover rendition (largest `coverVariants` entry, else `coverUrl`) as a blob and persist it in a new IndexedDB `covers` store keyed by book id (schema version bump). 2. On the shelf (`my-books-shelf`), prefer the stored cover blob (object URL) for books that are downloaded; fall back to the presigned URL otherwise. 3. Delete the stored cover when the offline copy is removed. Related: #879 (SW dead-URL fallback), reader/Kavita-parity offline workstream (PR-8), spikersoft-backend#499.
Sign in to join this conversation.