Repository navigation
fix(jellycompat): keep a stored subtitle's URL on that subtitle after an earlier one is deleted - #4177
Conversation
… an earlier one is deleted Stored subtitles take positional stream indexes after the file's own tracks, and their DeliveryUrl carried only that index. Deleting an earlier stored subtitle moved every issued URL onto the next one, so a Jellyfin client refetching its subtitle got another language, or a 404. Issued stored-subtitle URLs now also carry StoredSubtitleId, and the subtitle route serves that subtitle of the file whatever the index says, or 404 once it is gone. URLs without it still resolve by index. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 1 minute. View limit details
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Related issue: N/A
Validation tasks: none
Other clients: N/A (jellycompat-only fix; the Apple, Android, Roku and web clients use the native stream route, whose issued subtitle URLs already carry
downloaded_subtitle_id)Jellyfin apps can get the wrong subtitle after someone deletes a stored (downloaded or uploaded) subtitle. jellycompat numbers stored subtitles after the file's own tracks in list order, and their
DeliveryUrlcarried only that number. Deleting a stored subtitle moved every later one down by one, so an app that fetched its subtitle URL again (a reload, a seek, a timed window) got the next stored subtitle in another language. The last one in the list got a 404.On main, with French, German and Spanish stored subtitles, the German subtitle's URL returns the Spanish subtitle once the French one is deleted, and the French URL returns German.
Approach
Each stored subtitle's
DeliveryUrl, from PlaybackInfo and from item detail, now also carriesStoredSubtitleId. When the subtitle route sees that parameter, it serves that stored subtitle of the media source's file and ignores the index. It answers 404 once the subtitle is deleted, and for an ID that belongs to another file or is malformed. This is how the native stream route already pins its URLs withdownloaded_subtitle_id.The stream indexes Jellyfin apps see don't change. A URL without the parameter, as an app builds from the index itself, still resolves the index against the current list.
docs/jellycompat-api.mddescribes the parameter.What this leaves alone:
Validation
DELETE /api/v2/subtitles/stored/{id}, and fetched the same URLs again.go build,gofmt,go mod tidy -diff,go vet,make lint-changed,make lint-router-recovery,make verify-local-paths,verify-bidi,verify-size-ratchetandverify-route-inventorypass.make test-go: jellycompat and every other package pass, apart from the cases below. None of the failing packages imports the changed code.internal/api/handlers,internal/backup,internal/ebookconvertandinternal/uploadsfailed because the build host's umask made their temp directories group-writable. They pass with a privateTMPDIR.internal/mediasampleandinternal/playbackeach have one real-FFmpeg test that fails the same way on unmodified main on that host.Evidence: https://evidence.siloserver.org/r/silo-server/jellycompat-stored-subtitle-identity/
Risks
?StoredSubtitleId=N. An app that adds its token as a second?query string on these URLs would break. PlaybackInfo URLs already carried?PlaySessionId=, so such an app would already fail there.Checklist
AI Disclosure
Plan round:
Code review (high): found the following, all fixed:
Other findings predate this change and are left alone: the positional path swallows lookup errors, and a subtitle deleted mid-request returns 500.
Simplify: a simplify pass ran on the change.
Background review: gpt-6.1-sol reviewed 0f46472 and found nothing to post.
🤖 Generated with Claude Code