Skip to content

fix(jellycompat): match the Static stream query parameter case-insensitively - #157

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
d3v1l1989:fix/jellycompat-static-query-case-insensitive
Jun 15, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
d3v1l1989:fix/jellycompat-static-query-case-insensitive

Conversation

@d3v1l1989

@d3v1l1989 d3v1l1989 commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

GET /Videos/{id}/stream?static=true (lowercase key) returns 404 "Playback session not found" for clients that direct-play without first calling PlaybackInfo. HandleVideoStream reads the static-play guard case-sensitively (r.URL.Query().Get("Static")), so a lowercase static key never triggers the on-the-fly createStaticPlaySession fallback, and the earlier resolvePlaybackRoute error surfaces as a 404.

Observed against a live deployment: SenPlayer sends static=true (lowercase) and 404s ~83% of its direct-play attempts (≈246 fail / 50 ok in a ~20-minute capture). A valid api_key / X-Emby-Token / PlaySessionId is present, so this is not an auth failure. Any client that lowercases static is affected.

Approach

Read the guard through the package's existing newCaseInsensitiveQuery helper (already used for PlaySessionId in auth.go and HandleMasterManifest) so static / Static / any casing matches. One line; the value comparison was already case-insensitive via strings.EqualFold. This is the same case-insensitive-query class as the prior Wholphin lowercase playSessionId fix.

Testing

New playback_static_directplay_test.go:

  • lowercase static=true now serves the file (was 404)
  • uppercase Static=true still serves (regression guard for the original Infuse path)
  • no static + no prior session still 404s (the fallback must not fire unconditionally)
  • lowercase static + mediaSourceId (the exact SenPlayer call shape)

go test ./internal/jellycompat/... passes in a libvips-capable container. The test was mutation-verified (fails when the fix is reverted).

Notes

Additive and behavior-preserving — it only broadens which query-key casings trigger the existing static-play path.


AI-use disclosure: implemented and tested with AI assistance (Claude Code). The diff and tests were human-reviewed and run in a libvips Docker container.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed video streaming query parameters to be handled case-insensitively, improving compatibility with various client implementations.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5742ed27-bd2c-43fb-8eb3-4f2d12f59f21

📥 Commits

Reviewing files that changed from the base of the PR and between 2849443 and c257915.

📒 Files selected for processing (2)
  • internal/jellycompat/playback_static_directplay_test.go
  • internal/jellycompat/streams.go

📝 Walkthrough

Walkthrough

HandleVideoStream in streams.go now resolves the Static query parameter case-insensitively using newCaseInsensitiveQuery, fixing a mismatch when clients send static=true (lowercase). A new test file adds four end-to-end scenarios covering lowercase, uppercase, combined mediaSourceId, and missing-param cases.

Changes

Case-insensitive Static direct-play fix and tests

Layer / File(s) Summary
Case-insensitive Static query check
internal/jellycompat/streams.go
Replaces r.URL.Query().Get("Static") with newCaseInsensitiveQuery(...).Get("Static") so that static=true (lowercase) and Static=true (uppercase) both trigger the direct-play session path.
End-to-end tests for static direct-play
internal/jellycompat/playback_static_directplay_test.go
Adds newStaticDirectPlayHandler factory (temp file, empty playback store, stub session manager) and four tests: LowercaseStaticServesFile, LowercaseStaticWithMediaSourceId, UppercaseStaticServesFile, and NoStaticNoSessionReturns404. A shared request helper builds GET /Videos/{id}/stream with chi route params and compat session context.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: making the Static stream query parameter case-insensitive in jellycompat.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Quick104

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@Quick104
Quick104 merged commit 5783b42 into Silo-Server:main Jun 15, 2026
1 check passed
@d3v1l1989
d3v1l1989 deleted the fix/jellycompat-static-query-case-insensitive branch June 15, 2026 22:19
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.

2 participants