Skip to content

fix: show a Google Books cover and description that were dropped - #183

Open
memnos wants to merge 1 commit into
rdborg:mainfrom
memnos:feat/google-books-cover
Open

memnos wants to merge 1 commit into
rdborg:mainfrom
memnos:feat/google-books-cover

Conversation

@memnos

@memnos memnos commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What does this change?

Follow-up to #174. Two cases where Google Books has a cover and a description, and the book page showed neither.

  • The thumbnail address is left as Google sent it. It is no longer rewritten from zoom=1 to zoom=3. When Google has no larger scan, zoom=3 is a blank picture that says "image not available", and that picture was saved and shown. The real thumbnail, even when it is small, is kept.
  • A book page whose search hit has a title but no description now asks for that one volume. The search list often omits the description, and the volume itself still has it (or a short extract when the description field is empty). A hit that already has a description is not asked again. If that lookup fails, the page still opens from the search hit.
  • A Google Books cover address gains ?v= from the time of the saved file. Browsers keep /api/book-covers/gb-<id>.jpg for a month and will not ask again, so a cover that was replaced stayed blank on screen. The new address makes the browser fetch the picture that is actually saved.

Why?

Seen with L'elmo di Scipio (Angelo Soro, 2025). Google Books has the yellow cover and the full Italian description. Mediarium showed the blank "image not available" picture and, until the volume was asked for, no description. The book is on neither Open Library nor Hardcover, so this page is entirely what Google Books returned. The description came back once the volume was requested. The cover on disk was already the real thumbnail, but the browser kept serving the blank picture it had stored for that same address.

How did you test it?

  • gofmt -w on the touched files, then gofmt left them unchanged.
  • go test ./internal/books/ ./internal/api/ -count=1 -run 'TestGoogle|TestMergeGoogle' passes. New cases: a zoom=1 thumbnail stays zoom=1 and loses edge=curl; a volume with no description uses the search extract; a book page whose list hit has no description asks for that volume and shows it; a saved Google cover address may carry ?v=.
  • On a running build, the same book then returned the yellow thumbnail (128×192) and the description that starts "Cagliari, 1980". Reloading the page with the new ?v= address is what shows that thumbnail instead of the cached blank picture.
  • docs/books.md already says Google Books fills a missing cover or description, so that page was left as it is. CHANGELOG.md has the fix under Unreleased.

Checklist

  • go test ./... passes and gofmt -l . prints nothing
  • Web changes: npm run lint, npm test and npm run build pass in web/
  • Tests added or updated for changed logic
  • Matching page in docs/ updated, and a line added to CHANGELOG.md under "Unreleased"
  • Changed a route, environment variable or setting? Ran go run ./tools/docgen and committed the result
  • Screenshots attached for visible changes
  • No API keys, passwords or personal data in code, logs, tests or screenshots

Made with Cursor

The thumbnail address was rewritten to a larger zoom. When Google has no larger scan it answers with a blank "image not available" picture, and that picture was what got saved. The search list also often leaves the description out, and the book page trusted that empty answer. Keep the thumbnail Google sent, ask for the volume when the blurb is missing, and change the cover address when the saved file changes so a browser does not keep the blank picture.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant