mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
updated rest routing to only match numeric IDs.
eg. Match: api/series/12 No Match: api/series/abc
This commit is contained in:
@@ -11,7 +11,7 @@ namespace NzbDrone.Api.REST
|
|||||||
where TResource : RestResource, new()
|
where TResource : RestResource, new()
|
||||||
{
|
{
|
||||||
private const string ROOT_ROUTE = "/";
|
private const string ROOT_ROUTE = "/";
|
||||||
private const string ID_ROUTE = "/{id}";
|
private const string ID_ROUTE = @"/(?<id>[\d]{1,7})";
|
||||||
|
|
||||||
private Action<int> _deleteResource;
|
private Action<int> _deleteResource;
|
||||||
private Func<int, TResource> _getResourceById;
|
private Func<int, TResource> _getResourceById;
|
||||||
@@ -56,6 +56,12 @@ namespace NzbDrone.Api.REST
|
|||||||
_getResourceById = value;
|
_getResourceById = value;
|
||||||
Get[ID_ROUTE] = options =>
|
Get[ID_ROUTE] = options =>
|
||||||
{
|
{
|
||||||
|
int id;
|
||||||
|
if (!Int32.TryParse(options.Id, out id))
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
var resource = GetResourceById((int)options.Id);
|
var resource = GetResourceById((int)options.Id);
|
||||||
return resource.AsResponse();
|
return resource.AsResponse();
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user