Files
jellyfin/MediaBrowser.Model/Dlna
Cosmin Dumitru 37b50fe13c Fix malformed query string in StreamInfo.ToUrl() causing 500 error via proxies
StreamInfo.ToUrl() generated URLs like `/master.m3u8?&DeviceId=...` (note `?&`)
because `?` was appended to the path and all parameters started with `&`. When
the first optional parameter (DeviceProfileId) was null, the result was a
malformed query string.

This is harmless when clients hit Jellyfin directly (ASP.NET Core tolerates `?&`),
but when accessed through a reverse proxy that parses and re-serializes the URL
(e.g. Home Assistant ingress via aiohttp/yarl), `?&` becomes `?=&` — introducing
an empty-key query parameter. ParseStreamOptions then crashes on `param.Key[0]`
with IndexOutOfRangeException.

Changes:
- StreamInfo.ToUrl(): Track query start position and replace the first `&` with
  `?` after all parameters are appended, producing valid query strings
- ParseStreamOptions: Guard against empty query parameter keys
- Tests: Remove .Replace("?&", "?") workaround that masked the bug

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:08:35 +01:00
..
2024-09-17 20:35:23 +02:00
2020-02-23 12:11:43 +01:00
2024-09-17 20:35:23 +02:00
2025-01-25 20:05:15 -05:00
2020-02-23 12:11:43 +01:00
2020-02-23 12:11:43 +01:00
2020-06-15 10:45:55 +12:00
2020-02-23 12:11:43 +01:00
2024-09-17 20:35:23 +02:00
2020-02-23 12:11:43 +01:00