diff --git a/SecureCoding/SecureIO/SecurePath.cs b/SecureCoding/SecureIO/SecurePath.cs index 162ce8d..981c2cf 100644 --- a/SecureCoding/SecureIO/SecurePath.cs +++ b/SecureCoding/SecureIO/SecurePath.cs @@ -115,13 +115,18 @@ public static SecurePath ConstructSecurePath(string basePath, string filename) /// public static SecurePath ConstructSecurePath(params string[] paths) { - if (paths.Length < 2) + if (paths.Length < 1) { - throw new ArgumentException("Paths array should contain at least 2 path segments"); + throw new ArgumentException("Paths array should contain at least 1 path segments"); } var basePath = paths[0]; + if (paths.Length < 2) + { + return CreateSecurePath(basePath); + } + if (basePath.ContainsInvalidPathCharacters()) { throw new InvalidOperationException($"Base path '{basePath}' contains invalid characters");