mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-23 06:00:47 +02:00
update PathInfo parsing
This commit is contained in:
parent
aa36fc0e6f
commit
10383a90e6
|
@ -6,9 +6,9 @@ using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Session;
|
using MediaBrowser.Controller.Session;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using ServiceStack.Text.Controller;
|
|
||||||
using ServiceStack.Web;
|
using ServiceStack.Web;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
protected string GetPathValue(int index)
|
protected string GetPathValue(int index)
|
||||||
{
|
{
|
||||||
var pathInfo = PathInfo.Parse(Request.PathInfo);
|
var pathInfo = Parse(Request.PathInfo);
|
||||||
var first = pathInfo.GetArgumentValue<string>(0);
|
var first = pathInfo[0];
|
||||||
|
|
||||||
// backwards compatibility
|
// backwards compatibility
|
||||||
if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase) ||
|
if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
@ -285,7 +285,24 @@ namespace MediaBrowser.Api
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pathInfo.GetArgumentValue<string>(index);
|
return pathInfo[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<string> Parse(string pathUri)
|
||||||
|
{
|
||||||
|
var actionParts = pathUri.Split(new[] { "://" }, StringSplitOptions.None);
|
||||||
|
|
||||||
|
var pathInfo = actionParts[actionParts.Length - 1];
|
||||||
|
|
||||||
|
var optionsPos = pathInfo.LastIndexOf('?');
|
||||||
|
if (optionsPos != -1)
|
||||||
|
{
|
||||||
|
pathInfo = pathInfo.Substring(0, optionsPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
var args = pathInfo.Split('/');
|
||||||
|
|
||||||
|
return args.Skip(1).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -61,9 +61,6 @@
|
||||||
<Reference Include="ServiceStack.Interfaces">
|
<Reference Include="ServiceStack.Interfaces">
|
||||||
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath>
|
<HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ServiceStack.Text">
|
|
||||||
<HintPath>..\ThirdParty\ServiceStack.Text\ServiceStack.Text.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\SharedVersion.cs">
|
<Compile Include="..\SharedVersion.cs">
|
||||||
|
|
Loading…
Reference in a new issue