Skip to content

Commit 664ef80

Browse files
kant2002ForNeVeR
authored andcommitted
Fix normalization issue with .. inside path
closes #134
1 parent 3a1e6d3 commit 664ef80

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

TruePath.Tests/PathStringsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public void SeparatorsAreDeduplicated(string input, string expected)
5959
[InlineData(".../..", "")]
6060
[InlineData(".../...", ".../...")]
6161
[InlineData(".../../...", "...")]
62+
[InlineData("foo/bar/../file.ext", "foo/file.ext")]
6263
public void DotFoldersAreTraversedCorrectly(string input, string expected)
6364
{
6465
Assert.Equal(NormalizeSeparators(expected), PathStrings.Normalize(input));

TruePath/PathStrings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ block is ".."
102102
}
103103
else if (jump != -1)
104104
{
105-
written = jump;
106-
buffer = normalized.Slice(written + 1);
105+
written = last ? jump : jump + 1;
106+
buffer = normalized.Slice(written);
107107
skip = true;
108108
}
109109
else

0 commit comments

Comments
 (0)