mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Fixed up StaticResourceProvider
This commit is contained in:
parent
92d913e4ac
commit
1edb1d211b
4 changed files with 33 additions and 44 deletions
|
@ -1,9 +1,12 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Api.Frontend
|
||||
{
|
||||
public class StaticResourceMapper : IMapHttpRequestsToDisk
|
||||
{
|
||||
private static readonly string[] Extensions = new[] { ".css", ".js", ".html", ".htm", ".jpg", ".jpeg", ".icon", ".gif", ".png", ".woff", ".ttf" };
|
||||
|
||||
public string Map(string resourceUrl)
|
||||
{
|
||||
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||||
|
@ -13,6 +16,14 @@ namespace NzbDrone.Api.Frontend
|
|||
return Path.Combine("ui", path);
|
||||
}
|
||||
|
||||
public RequestType IHandle { get { return RequestType.StaticResources; } }
|
||||
public bool CanHandle(string resourceUrl)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(resourceUrl))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Extensions.Any(resourceUrl.EndsWith);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue