Only split user agent if it can be split (#95)
Some checks failed
🏗️ Build Plugin / call (push) Has been cancelled
📝 Create/Update Release Draft & Release Bump PR / call (push) Has been cancelled
🔬 Run CodeQL / call (push) Has been cancelled
🧪 Test Plugin / call (push) Has been cancelled

This commit is contained in:
Tim Eisele 2024-11-06 15:49:13 +01:00 committed by GitHub
parent edcdf04acd
commit 36d957c4e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,7 +66,12 @@ public class DlnaServerController : ControllerBase
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);
}