diff --git a/NzbDrone.Api/REST/RestModule.cs b/NzbDrone.Api/REST/RestModule.cs index 15747d1bd..817ff559b 100644 --- a/NzbDrone.Api/REST/RestModule.cs +++ b/NzbDrone.Api/REST/RestModule.cs @@ -11,7 +11,7 @@ namespace NzbDrone.Api.REST where TResource : RestResource, new() { private const string ROOT_ROUTE = "/"; - private const string ID_ROUTE = "/{id}"; + private const string ID_ROUTE = @"/(?[\d]{1,7})"; private Action _deleteResource; private Func _getResourceById; @@ -55,10 +55,16 @@ namespace NzbDrone.Api.REST { _getResourceById = value; Get[ID_ROUTE] = options => - { - var resource = GetResourceById((int)options.Id); - return resource.AsResponse(); - }; + { + int id; + if (!Int32.TryParse(options.Id, out id)) + { + throw new NotImplementedException(); + } + + var resource = GetResourceById((int)options.Id); + return resource.AsResponse(); + }; } }