From 36d957c4e80536c55240189e885cc0a89edb1783 Mon Sep 17 00:00:00 2001 From: Tim Eisele Date: Wed, 6 Nov 2024 15:49:13 +0100 Subject: [PATCH] Only split user agent if it can be split (#95) --- src/Jellyfin.Plugin.Dlna/Api/DlnaServerController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Jellyfin.Plugin.Dlna/Api/DlnaServerController.cs b/src/Jellyfin.Plugin.Dlna/Api/DlnaServerController.cs index e814d37..99630c3 100644 --- a/src/Jellyfin.Plugin.Dlna/Api/DlnaServerController.cs +++ b/src/Jellyfin.Plugin.Dlna/Api/DlnaServerController.cs @@ -66,7 +66,12 @@ public ActionResult GetDescriptionXml([FromRoute, Required] string serve string? userAgent = Request.Headers.UserAgent; if (userAgent is not null) { - userAgent = userAgent.Substring(0, userAgent.IndexOf('/')); + var firstIndexOfSlash = userAgent.IndexOf('/'); + if (firstIndexOfSlash > 0) + { + userAgent = userAgent.Substring(0, firstIndexOfSlash); + } + useRelativePath = _relativePathUserAgents.Contains(userAgent, StringComparison.Ordinal); }