mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
fixed linux path validation
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common.EnsureThat.Resources;
|
using NzbDrone.Common.EnsureThat.Resources;
|
||||||
@@ -106,9 +107,9 @@ namespace NzbDrone.Common.EnsureThat
|
|||||||
|
|
||||||
if (EnvironmentProvider.IsLinux)
|
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
|
else
|
||||||
@@ -119,7 +120,7 @@ namespace NzbDrone.Common.EnsureThat
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Network path
|
//Network path
|
||||||
if (param.Value.StartsWith("\\")) return param;
|
if (param.Value.StartsWith(Path.DirectorySeparatorChar.ToString())) return param;
|
||||||
|
|
||||||
if (!windowsPathRegex.IsMatch(param.Value))
|
if (!windowsPathRegex.IsMatch(param.Value))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user