From 6d983daf78e22290cf3962ccb4f87f9413a8b34a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 11 Apr 2015 17:34:05 -0400 Subject: updated image magick --- .../HttpServer/HttpListenerHost.cs | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs') diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index f91054206..dc9656f80 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -305,7 +305,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer var operationName = httpReq.OperationName; var localPath = url.LocalPath; - if (string.Equals(localPath, "/mediabrowser/", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(localPath, "/mediabrowser/", StringComparison.OrdinalIgnoreCase) || + string.Equals(localPath, "/emby/", StringComparison.OrdinalIgnoreCase)) { httpRes.RedirectToUrl(DefaultRedirectPath); return Task.FromResult(true); @@ -315,6 +316,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer httpRes.RedirectToUrl("mediabrowser/" + DefaultRedirectPath); return Task.FromResult(true); } + if (string.Equals(localPath, "/emby", StringComparison.OrdinalIgnoreCase)) + { + httpRes.RedirectToUrl("emby/" + DefaultRedirectPath); + return Task.FromResult(true); + } if (string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase)) { httpRes.RedirectToUrl(DefaultRedirectPath); @@ -384,6 +390,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer foreach (var route in clone) { + routes.Add(new RouteAttribute(NormalizeEmbyRoutePath(route.Path), route.Verbs) + { + Notes = route.Notes, + Priority = route.Priority, + Summary = route.Summary + }); routes.Add(new RouteAttribute(NormalizeRoutePath(route.Path), route.Verbs) { Notes = route.Notes, @@ -398,11 +410,37 @@ namespace MediaBrowser.Server.Implementations.HttpServer Priority = route.Priority, Summary = route.Summary }); + routes.Add(new RouteAttribute(DoubleNormalizeEmbyRoutePath(route.Path), route.Verbs) + { + Notes = route.Notes, + Priority = route.Priority, + Summary = route.Summary + }); } return routes.ToArray(); } + private string NormalizeEmbyRoutePath(string path) + { + if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) + { + return "/emby" + path; + } + + return "emby/" + path; + } + + private string DoubleNormalizeEmbyRoutePath(string path) + { + if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) + { + return "/emby/emby" + path; + } + + return "emby/emby/" + path; + } + private string NormalizeRoutePath(string path) { if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) -- cgit v1.2.3