aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-03-15 17:42:57 +0100
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-03-15 17:42:57 +0100
commit05ab61200a181ff39034a5c3ba30a4ee2672971d (patch)
treecfb623d705da1aa6eb59bff958d2a57a00742434 /MediaBrowser.WebDashboard
parent602112fba433fa8919133d7ff292b0cd5a912aa2 (diff)
Do not call UseContentRoot() on the web host builder
This call has nothing to do with static web content and should not have ever been called with the web content path: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/?view=aspnetcore-3.1&tabs=windows#content-root Since this call is removed, the ContentRoot property is also removed from ApplicationHost as it is no longer needed. Finally, move validation of the static content path to the DashboardService where it is actually used.
Diffstat (limited to 'MediaBrowser.WebDashboard')
-rw-r--r--MediaBrowser.WebDashboard/Api/DashboardService.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 11901c25fb..0114f5d602 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -136,6 +136,17 @@ namespace MediaBrowser.WebDashboard.Api
_resultFactory = resultFactory;
_resourceFileManager = resourceFileManager;
_appConfig = appConfig;
+
+ // Validate web content path
+ string webContentPath = DashboardUIPath;
+ bool webContentPathValid = appConfig.NoWebContent() || (Directory.Exists(webContentPath) && Directory.GetFiles(webContentPath).Any());
+ if (!webContentPathValid)
+ {
+ throw new InvalidOperationException(
+ "The server is expected to host web content, but the provided content directory is either " +
+ $"invalid or empty: {webContentPath}. If you do not want to host web content with the server, " +
+ $"you may set the '{Controller.Extensions.ConfigurationExtensions.NoWebContentKey}' flag.");
+ }
}
/// <summary>