mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
FolderWritableValidator
Fixed: Information in UI when attempting to add a root folder that is not writable Fixes #1280
This commit is contained in:
parent
ea0982ecae
commit
67ff871cf6
@ -17,7 +17,8 @@ public RootFolderModule(IRootFolderService rootFolderService,
|
||||
PathExistsValidator pathExistsValidator,
|
||||
DroneFactoryValidator droneFactoryValidator,
|
||||
MappedNetworkDriveValidator mappedNetworkDriveValidator,
|
||||
StartupFolderValidator startupFolderValidator)
|
||||
StartupFolderValidator startupFolderValidator,
|
||||
FolderWritableValidator folderWritableValidator)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
_rootFolderService = rootFolderService;
|
||||
@ -34,7 +35,8 @@ public RootFolderModule(IRootFolderService rootFolderService,
|
||||
.SetValidator(droneFactoryValidator)
|
||||
.SetValidator(mappedNetworkDriveValidator)
|
||||
.SetValidator(startupFolderValidator)
|
||||
.SetValidator(pathExistsValidator);
|
||||
.SetValidator(pathExistsValidator)
|
||||
.SetValidator(folderWritableValidator);
|
||||
}
|
||||
|
||||
private RootFolderResource GetRootFolder(int id)
|
||||
|
@ -1036,6 +1036,7 @@
|
||||
<Compile Include="Validation\NzbDroneValidationState.cs" />
|
||||
<Compile Include="Validation\Paths\MappedNetworkDriveValidator.cs" />
|
||||
<Compile Include="Validation\Paths\DroneFactoryValidator.cs" />
|
||||
<Compile Include="Validation\Paths\FolderWritableValidator.cs" />
|
||||
<Compile Include="Validation\Paths\PathExistsValidator.cs" />
|
||||
<Compile Include="Validation\Paths\PathValidator.cs" />
|
||||
<Compile Include="Validation\Paths\StartupFolderValidator.cs" />
|
||||
|
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using FluentValidation.Validators;
|
||||
using NzbDrone.Common.Disk;
|
||||
|
||||
namespace NzbDrone.Core.Validation.Paths
|
||||
{
|
||||
public class FolderWritableValidator : PropertyValidator
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
|
||||
public FolderWritableValidator(IDiskProvider diskProvider)
|
||||
: base($"Folder is not writable by user {Environment.UserName}")
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
}
|
||||
|
||||
protected override bool IsValid(PropertyValidatorContext context)
|
||||
{
|
||||
if (context.PropertyValue == null) return false;
|
||||
|
||||
return (_diskProvider.FolderWritable(context.PropertyValue.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
@ -85,7 +85,6 @@
|
||||
<option name="m_minLength" value="1" />
|
||||
<option name="m_maxLength" value="32" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="LossyEncoding" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="NegatedIfStatementJS" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="NestedAssignmentJS" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="NestedFunctionCallJS" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
|
1
src/UI/.idea/modules.xml
generated
1
src/UI/.idea/modules.xml
generated
@ -6,4 +6,3 @@
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user