diff --git a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs
index 9c9fed0d4..a4c0f892b 100644
--- a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs
+++ b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs
@@ -16,7 +16,8 @@ namespace NzbDrone.Api.RootFolders
RootFolderValidator rootFolderValidator,
PathExistsValidator pathExistsValidator,
DroneFactoryValidator droneFactoryValidator,
- MappedNetworkDriveValidator mappedNetworkDriveValidator)
+ MappedNetworkDriveValidator mappedNetworkDriveValidator,
+ StartupFolderValidator startupFolderValidator)
: base(signalRBroadcaster)
{
_rootFolderService = rootFolderService;
@@ -32,6 +33,7 @@ namespace NzbDrone.Api.RootFolders
.SetValidator(rootFolderValidator)
.SetValidator(droneFactoryValidator)
.SetValidator(mappedNetworkDriveValidator)
+ .SetValidator(startupFolderValidator)
.SetValidator(pathExistsValidator);
}
diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj
index ae947c2f4..7369f3002 100644
--- a/src/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/src/NzbDrone.Core/NzbDrone.Core.csproj
@@ -1032,6 +1032,7 @@
+
diff --git a/src/NzbDrone.Core/Validation/Paths/StartupFolderValidator.cs b/src/NzbDrone.Core/Validation/Paths/StartupFolderValidator.cs
new file mode 100644
index 000000000..89fd0893e
--- /dev/null
+++ b/src/NzbDrone.Core/Validation/Paths/StartupFolderValidator.cs
@@ -0,0 +1,25 @@
+using FluentValidation.Validators;
+using NzbDrone.Common.EnvironmentInfo;
+using NzbDrone.Common.Extensions;
+
+namespace NzbDrone.Core.Validation.Paths
+{
+ public class StartupFolderValidator : PropertyValidator
+ {
+ private readonly IAppFolderInfo _appFolderInfo;
+
+
+ public StartupFolderValidator(IAppFolderInfo appFolderInfo)
+ : base("Path cannot be an ancestor of the start up folder")
+ {
+ _appFolderInfo = appFolderInfo;
+ }
+
+ protected override bool IsValid(PropertyValidatorContext context)
+ {
+ if (context.PropertyValue == null) return true;
+
+ return !_appFolderInfo.StartUpFolder.IsParentPath(context.PropertyValue.ToString());
+ }
+ }
+}
\ No newline at end of file