Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 392c198

Browse files
committed
Use sanitizedPath
1 parent da5b657 commit 392c198

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ public static bool GlobPath(this string filePath, string pattern)
11001100

11011101
if (dirPattern.IndexOf("**", StringComparison.Ordinal) >= 0)
11021102
{
1103-
if (!filePath.StartsWith(dirPattern.LeftPart("**").TrimEnd('*', '/')))
1103+
if (!sanitizedPath.StartsWith(dirPattern.LeftPart("**").TrimEnd('*', '/')))
11041104
return false;
11051105
}
11061106
else if (dirPattern.IndexOf('*') >= 0 || dirPattern.IndexOf('?') >= 0)

tests/ServiceStack.Text.Tests/GlobPathTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public void Does_validate_GlobPaths()
4545
Assert.That("dir/a/b/file.txt".GlobPath("dir/**/file.txt"));
4646
Assert.That("dir/a/b/c/d/e/file.txt".GlobPath("dir/**/file.txt"));
4747
Assert.That("dir/a/b/c/d/e/file.json".GlobPath("dir/**/*.json"));
48+
49+
Assert.That("/jspm_packages/npm/[email protected]".GlobPath("jspm_packages/**/*.json"));
4850
}
4951
}
5052
}

0 commit comments

Comments
 (0)