Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions SecureCoding/SecureIO/SecurePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,18 @@ public static SecurePath ConstructSecurePath(string basePath, string filename)
/// </exception>
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");
Expand Down