Repository navigation
fix(audiobooks): /api/authors/{id} 500 — select photo_path, not poster_path - #315
Conversation
GetAuthorByID selected poster_path from the people table, but the
person-image column is photo_path, so every GET /api/authors/{id}
request failed with SQLSTATE 42703 and a 500. Since photo_path is
NOT NULL DEFAULT '', the nullable scan is also dropped.
Co-Authored-By: Claude Fable 5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesAuthor Lookup Fix
Estimated code review effort: 1 (Trivial) | ~5 minutes PoemA rabbit hopped through database rows, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed2e6b65be
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| row := s.Pool.QueryRow(ctx, `SELECT name, poster_path FROM people WHERE id = $1`, id) | ||
| if err := row.Scan(&name, &poster); err != nil { | ||
| var name, photo string | ||
| row := s.Pool.QueryRow(ctx, `SELECT name, photo_path FROM people WHERE id = $1`, id) |
There was a problem hiding this comment.
Gate author detail on accessible audiobooks
When the caller's AccessFilter excludes every audiobook for this person (for example a profile restricted to other libraries or a lower content rating), this lookup still returns the people row by id before any access predicate is applied; the later appendAudiobookAccessConditions only filters author.Books. Now that the query succeeds, /api/authors/{id} can return 200 with the author name and zero books for authors the profile cannot see, so the person lookup should be tied to at least one accessible audiobook and return ErrNotFound otherwise.
Useful? React with 👍 / 👎.
…the corrected GetAuthorByID query
GetAuthorByID selected poster_path from the people table, but the
person-image column is photo_path, so every GET /api/authors/{id}
request failed with SQLSTATE 42703 and a 500. Since photo_path is
NOT NULL DEFAULT '', the nullable scan is also dropped.
Co-authored-by: Claude Fable 5 <[email protected]>
Problem
Every
GET /api/authors/{id}request on the Audiobookshelf-compat API returned a 500.ABSMediaStore.GetAuthorByIDselectedposter_pathfrom thepeopletable, but the person-image column isphoto_path, so the query always failed withSQLSTATE 42703 (column does not exist):Reported via an internal Discord thread by a user of a third-party ABS client; author detail pages failed to load.
Fix
Select
photo_pathinstead. Since the column isNOT NULL DEFAULT '', the nullable*stringscan is replaced with a plainstringassigned directly toAuthor.PosterPath(empty stays empty, matching prior behavior).Only the detail path was affected — author listing reads from the
abs_audiobook_author_countsMV and does not touch this column.Verification
go build ./internal/audiobooks/andgo vet ./internal/audiobooks/pass.migrations/sql/001_schema.sql(people.photo_path).Disclosure
Implemented with Claude Code (AI-assisted); change reviewed against the schema.
🤖 Generated with Claude Code
Summary by CodeRabbit