Skip to content

Commit

Permalink
Only split user agent if it can be split (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowghost authored Nov 6, 2024
1 parent edcdf04 commit 36d957c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Jellyfin.Plugin.Dlna/Api/DlnaServerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ public ActionResult<string> 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);
}

Expand Down

0 comments on commit 36d957c

Please sign in to comment.