bug #32138 [Filesystem] fix mirroring directory into parent directory (xabbuh)
This PR was merged into the 4.3 branch.
Discussion
----------
[Filesystem] fix mirroring directory into parent directory
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #32089
| License | MIT
| Doc PR |
Commits
-------
b58a806340
fix mirroring directory into parent directory
This commit is contained in:
commit
c245f7c681
@ -569,14 +569,15 @@ class Filesystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->mkdir($targetDir);
|
$this->mkdir($targetDir);
|
||||||
$targetDirInfo = new \SplFileInfo($targetDir);
|
$filesCreatedWhileMirroring = [];
|
||||||
|
|
||||||
foreach ($iterator as $file) {
|
foreach ($iterator as $file) {
|
||||||
if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || 0 === strpos($file->getRealPath(), $targetDirInfo->getRealPath())) {
|
if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = $targetDir.substr($file->getPathname(), $originDirLen);
|
$target = $targetDir.substr($file->getPathname(), $originDirLen);
|
||||||
|
$filesCreatedWhileMirroring[$target] = true;
|
||||||
|
|
||||||
if (!$copyOnWindows && is_link($file)) {
|
if (!$copyOnWindows && is_link($file)) {
|
||||||
$this->symlink($file->getLinkTarget(), $target);
|
$this->symlink($file->getLinkTarget(), $target);
|
||||||
|
Reference in New Issue
Block a user