Repository navigation
Description
Problem
The Edit Metadata Images tab only offers artwork from metadata providers. Local sidecar files next to the media (poster.jpg, folder.jpg, fanart.jpg, clearlogo.png and so on) never appear there, even though the local NFO provider finds them during a refresh. For an item with no provider match, such as a self-made series that isn't on TMDB or TVDB, the tab is empty, so an admin has no way to choose or restore that item's artwork from the UI.
A user on Discord hit this when their local series poster went blank. The cause of the blank poster is fixed in #1978, but the only way they could recover it before that was renaming the file on disk and refreshing.
Why it doesn't work today
listAdminItemImagesbuilds its choices withFetchItemImages(internal/metadata/service.go), which calls each image provider with only provider IDs, content type and language. The NFO provider'sGetImages(internal/metadata/nfo/images.go) needs the item's sidecar search paths or media file paths and returns nothing without them.applyAdminItemImagegoes throughApplyItemImage, which downloads through the image cacher. Any URL that isn't HTTP(S) goes to the plugin resolver, so afile://source fails with "failed to resolve image URL".- Local sidecar files are only cached by the background image cache processor (
processLocalOneininternal/metadata/image_cache_processor.go). It keeps reads inside the owning library's roots, rejects symlinks and non-regular files, and caps files at 8 MiB.
Proposed change
- Give
FetchItemImagesthe item's local context for the picker (the same sidecar search paths and media file paths a refresh builds inlocalProviderContextForContent), so local images are listed next to provider images. Season pickers would get season-folder artwork the same way. - Let
applyAdminItemImageaccept a local source, but only one that matches a local image discovered for that item, never an arbitrary path from the request. Cache it with the same confinement, symlink and size checks asprocessLocalOne, then publish the selection and set the images lock the way provider choices do today. - Give local choices a preview the browser can load. Provider choices show their provider URL as the thumbnail, and a local file has no such URL.
Open questions
- Preview: an admin-only route that serves a downscaled copy of a listed choice, or caching local choices when the list is built?
- Should a local choice be stored under the
local/cached-key prefix, like sidecars cached during a refresh, so revision cleanup treats both the same way? - Should applying a local image set the images lock? A later refresh would usually pick the same file anyway, but the lock keeps the admin's choice if several local candidates exist.
Acceptance criteria
- For an item with local poster, backdrop or logo files, the Images tab lists them alongside provider images.
- For an item with no provider match, the Images tab lists its local images instead of nothing.
- Applying a listed local image caches it and shows it on the item without a refresh.
- The apply endpoint refuses a
file://URL that isn't one of the item's discovered local images, a path outside the library roots, a symlink, and a file over 8 MiB.
API and client impact
listAdminItemImages returns extra choices in its existing shape, with a provider ID that marks them as local. applyAdminItemImage accepts local source URLs that came from that list. No new operations. The web admin picker is the only caller: neither silo-apple nor silo-android uses these endpoints, so they need no change. Jellyfin compatibility has no equivalent picker.
AI disclosure
- Harness: Claude Code (Claude desktop app, Code tab)
- Tool(s): Claude Code, GitHub CLI
- Model(s): claude-opus-5-5
- Involvement: AI-assisted. Code paths were read from
internal/metadata/service.go,internal/metadata/nfo/images.go,internal/metadata/image_cache_processor.go,internal/apiv2/admin_catalog_images.goandinternal/api/handlers/admin_images.goat upstreammain1555e52. - Adversarial review: n/a
AI-assisted with Claude Opus. I directed the task and designed the work.
Activity