Skip to content

Commit

Permalink
Normalize ./ path segments
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Apr 6, 2017
1 parent 3a29c1d commit 15982d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public function makePathRelative($endPath, $startPath)
foreach ($pathSegments as $segment) {
if ('..' === $segment) {
array_pop($result);
} else {
} elseif ('.' !== $segment) {
$result[] = $segment;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,9 @@ public function providePathsForMakePathRelative()
array('C:/../../aa/../bb/cc', 'C:/aa/dd/..', '../bb/cc/'),
array('aa/bb', 'aa/cc', '../bb/'),
array('aa/cc', 'bb/cc', '../../aa/cc/'),
array('aa/bb', 'aa/./cc', '../bb/'),
array('aa/./bb', 'aa/cc', '../bb/'),
array('aa/./bb', 'aa/./cc', '../bb/'),
);

if ('\\' === DIRECTORY_SEPARATOR) {
Expand Down

0 comments on commit 15982d4

Please sign in to comment.