Skip to content
Permalink
Browse files

Hopefully Fix that Filesystem Opening error

  • Loading branch information...
da3dsoul committed Oct 7, 2019
1 parent e77ab21 commit fa9bd6d3558e11242226338872d4560cb711329e
@@ -386,7 +386,7 @@ public List<string> DirectoriesFromImportFolderPath(int cloudaccountid, [FromFor
if (cloudaccountid == 0)
{
FileSystemResult<IFileSystem> ff = CloudFileSystemPluginFactory.Instance.List
.FirstOrDefault(a => a.Name == "Local File System")
.FirstOrDefault(a => a.Name.EqualsInvariantIgnoreCase("Local File System"))
?.Init("", null, null);
if (ff?.IsOk ?? false)
n = ff.Result;
@@ -26,7 +26,7 @@ public new string Provider
base.Provider = value;
if (!string.IsNullOrEmpty(value))
{
_plugin = CloudFileSystemPluginFactory.Instance.List.FirstOrDefault(a => a.Name == value);
_plugin = CloudFileSystemPluginFactory.Instance.List.FirstOrDefault(a => a.Name.EqualsInvariantIgnoreCase(value));
}
}
}
@@ -90,7 +90,7 @@ public IFileSystem Connect()
Dictionary<string, object> auth = AuthInstance.AuthorizationProvider.Get(Provider);
if (auth == null)
throw new Exception("Application Authorization Not Found");
_plugin = CloudFileSystemPluginFactory.Instance.List.FirstOrDefault(a => a.Name == Provider);
_plugin = CloudFileSystemPluginFactory.Instance.List.FirstOrDefault(a => a.Name.EqualsInvariantIgnoreCase(Provider));
if (_plugin == null)
throw new Exception("Cannot find cloud provider '" + Provider + "'");
FileSystemResult<IFileSystem> res = _plugin.Init(Name, ShokoServer.Instance.OAuthProvider, auth, ConnectionString);
@@ -10,6 +10,7 @@
using NutzCode.CloudFileSystem;
using Shoko.Commons.Notification;
using Shoko.Models.Server;
using Shoko.Server.Extensions;
using Shoko.Server.Repositories;

namespace Shoko.Server.Models
@@ -102,7 +103,7 @@ public IFileSystem FileSystem
else
{
FileSystemResult<IFileSystem> ff = CloudFileSystemPluginFactory.Instance.List
.FirstOrDefault(a => a.Name == "Local File System")
.FirstOrDefault(a => a.Name.EqualsInvariantIgnoreCase("Local File System"))
?.Init("", null, null);
if (ff == null || !ff.IsOk)
throw new Exception(ff?.Error ?? "Error Opening Local Filesystem");
@@ -22,6 +22,7 @@
using NHibernate;
using NLog.Targets;
using NLog.Web;
using NutzCode.CloudFileSystem;
using NutzCode.CloudFileSystem.OAuth2;
using Shoko.Commons.Properties;
using Shoko.Models.Enums;
@@ -256,6 +257,20 @@ public bool StartUpServer()
logrotator.Start();
StartLogRotatorTimer();

if (!CloudFileSystemPluginFactory.Instance.List.Any())
{
logger.Error(
"No Filesystem Handlers were loaded. THIS IS A PROBLEM. The most likely cause is permissions issues in the installation directory.");
return false;
}

if (CloudFileSystemPluginFactory.Instance.List.FirstOrDefault(handler =>
handler.Name.EqualsInvariantIgnoreCase("Local File System")) == null)
{
string handlers = string.Join(", ", CloudFileSystemPluginFactory.Instance.List.Select(a => a.Name));
logger.Warn($"The local filesystem handler could not be found. These Filesystem Handlers were loaded: {handlers}");
}

SetupNetHosts();

Analytics.PostEvent("Server", "StartupFinished");
@@ -10,6 +10,7 @@
using Shoko.Commons.Properties;
using Shoko.Models.Azure;
using Shoko.Server.Commands;
using Shoko.Server.Extensions;
using Shoko.Server.Models;
using Shoko.Server.Providers.Azure;
using Shoko.Server.Repositories;
@@ -69,7 +70,7 @@ private void Init()
//Populate Cloud Providers
foreach (ICloudPlugin plugin in CloudFileSystemPluginFactory.Instance.List)
{
if (!plugin.Name.Equals("Local File System", StringComparison.InvariantCultureIgnoreCase))
if (!plugin.Name.EqualsInvariantIgnoreCase("Local File System"))
{
CloudProvider p = new CloudProvider
{

0 comments on commit fa9bd6d

Please sign in to comment.
You can’t perform that action at this time.