From fea10997addf3ff98b435f9a64f86052ad8ed23e Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Fri, 24 May 2013 16:40:40 -0700 Subject: [PATCH] fixed linux path validation --- NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs b/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs index 270251d86..d9def3064 100644 --- a/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs +++ b/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs @@ -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 @@ namespace NzbDrone.Common.EnsureThat 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 @@ namespace NzbDrone.Common.EnsureThat } //Network path - if (param.Value.StartsWith("\\")) return param; + if (param.Value.StartsWith(Path.DirectorySeparatorChar.ToString())) return param; if (!windowsPathRegex.IsMatch(param.Value)) {