mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-20 21:16:56 +00:00
fixed linux path validation
This commit is contained in:
parent
2f13832769
commit
fea10997ad
1 changed files with 4 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NzbDrone.Common.EnsureThat.Resources;
|
||||
|
@ -106,9 +107,9 @@ public static Param<string> IsValidPath(this Param<string> param)
|
|||
|
||||
if (EnvironmentProvider.IsLinux)
|
||||
{
|
||||
if (!param.Value.StartsWith("\\"))
|
||||
if (!param.Value.StartsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
{
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, string.Format("value [{0}] is not a valid *nix path. paths must start with \\", param.Value));
|
||||
throw ExceptionFactory.CreateForParamValidation(param.Name, string.Format("value [{0}] is not a valid *nix path. paths must start with /", param.Value));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -119,7 +120,7 @@ public static Param<string> IsValidPath(this Param<string> param)
|
|||
}
|
||||
|
||||
//Network path
|
||||
if (param.Value.StartsWith("\\")) return param;
|
||||
if (param.Value.StartsWith(Path.DirectorySeparatorChar.ToString())) return param;
|
||||
|
||||
if (!windowsPathRegex.IsMatch(param.Value))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue