Previously, images with no language were ranked higher (score 3) than
English images (score 2), causing poorly rated languageless images to
be selected over well-rated English alternatives for posters and logos.
Swap the priority so English is preferred over no-language images.
Backdrop images are unaffected as they have their own dedicated sorting.
Add unit tests for OrderByLanguageDescending.
Fixes#13310
- Add missing param and returns XML doc tags (SA1611, SA1615)
- Remove trailing alignment whitespace in test attributes (SA1025)
- Use nullable string parameter for null test case (xUnit1012)
Encoders sometimes produce sample aspect ratios like 3201:3200
(0.03% off square) for content that has effectively square pixels.
The exact string comparison against "1:1" marks these as anamorphic,
which triggers unnecessary transcoding on clients that require
non-anamorphic video.
Parse the SAR ratio numerically and treat values within 1% of 1:1
as square pixels. This threshold is well clear of the nearest real
anamorphic SAR (PAL 4:3 at 16:15 = 6.67% off).
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>
The DisplayTitle property was using .NET's CultureInfo.GetCultures(NeutralCultures)
to resolve language display names. Since zh-CN is a specific culture (not neutral),
it would fall back to the base 'zh' code, resulting in generic 'Chinese' instead
of 'Chinese (Simplified)'.
This change adds a LocalizedLanguage property to MediaStream that gets populated
via LocalizationManager.FindLanguageInfo() when streams are retrieved from the
database. This leverages Jellyfin's existing iso6392.txt mappings which correctly
map zh-CN to 'Chinese (Simplified)'.
The same pattern is already used for other localized strings like LocalizedDefault
and LocalizedExternal.
When a password hash is missing the 'iterations' parameter, Verify now
throws a descriptive FormatException instead of KeyNotFoundException.
- Extract GetIterationsParameter() helper method to avoid code duplication
- Provide distinct error messages for missing vs invalid parameters
- Add comprehensive unit tests for CryptographyProvider
When querying items with recursive=true, items with types from removed
plugins would cause a 500 error. Now these items are skipped with a
warning log instead of throwing an exception.
Fixes#15945
The DisplayTitle property was using .NET's CultureInfo.GetCultures(NeutralCultures)
to resolve language display names. Since zh-CN is a specific culture (not neutral),
it would fall back to the base 'zh' code, resulting in generic 'Chinese' instead
of 'Chinese (Simplified)'.
This change adds a LocalizedLanguage property to MediaStream that gets populated
via LocalizationManager.FindLanguageInfo() when streams are retrieved from the
database. This leverages Jellyfin's existing iso6392.txt mappings which correctly
map zh-CN to 'Chinese (Simplified)'.
The same pattern is already used for other localized strings like LocalizedDefault
and LocalizedExternal.