fix(playback): canonicalize base URL scheme case

FFmpeg's protocol lookup is case-sensitive, so a stored "Https://" base
URL reaches mpv verbatim through the direct-play string concat and fails
with "Protocol not found" (API calls survive because Dart's Uri
lowercases the scheme). Canonicalize at Jellyfin URL intake and in the
connection constructor so persisted configs self-heal on load, and
register mpv-escaped (https\://) redaction variants so option-value
logs stop leaking the server host.

close #1465
This commit is contained in:
edde746
2026-07-04 19:43:32 +02:00
parent dd09e421bf
commit 837fdf4031
7 changed files with 100 additions and 12 deletions
+15
View File
@@ -13,3 +13,18 @@ String stripTrailingSlash(String input) {
}
return trimmed;
}
final RegExp _schemePattern = RegExp(r'^[A-Za-z][A-Za-z\d+.-]*://');
/// Canonicalizes a server base URL: trims, strips one trailing `/`, and
/// lowercases the scheme (`Https://host` → `https://host`). Dart's `Uri`
/// normalizes scheme case for API requests, but URLs handed to the player as
/// raw strings don't get that treatment, and FFmpeg's protocol lookup is
/// case-sensitive — a mixed-case scheme fails with "Protocol not found".
/// Everything after `://` is left untouched.
String canonicalizeBaseUrl(String input) {
final stripped = stripTrailingSlash(input);
final match = _schemePattern.firstMatch(stripped);
if (match == null) return stripped;
return stripped.replaceRange(0, match.end, match.group(0)!.toLowerCase());
}