1
0
Fork 0

Revert "Allow use of parent directories in PathDownloader when not mirroring the path"

pull/5984/head
Jordi Boggiano 2016-12-20 17:27:24 +01:00 committed by GitHub
parent b2efcb1078
commit fcbc1044e0
1 changed files with 7 additions and 7 deletions

View File

@ -45,6 +45,13 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
)); ));
} }
if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
throw new \RuntimeException(sprintf(
'Package %s cannot install to "%s" inside its source at "%s"',
$package->getName(), realpath($path), $realUrl
));
}
// Get the transport options with default values // Get the transport options with default values
$transportOptions = $package->getTransportOptions() + array('symlink' => null); $transportOptions = $package->getTransportOptions() + array('symlink' => null);
@ -65,13 +72,6 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
$allowedStrategies = array(self::STRATEGY_MIRROR); $allowedStrategies = array(self::STRATEGY_MIRROR);
} }
if ($currentStrategy != self::STRATEGY_MIRROR && strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
throw new \RuntimeException(sprintf(
'Package %s cannot install to "%s" inside its source at "%s"',
$package->getName(), realpath($path), $realUrl
));
}
$fileSystem = new Filesystem(); $fileSystem = new Filesystem();
$this->filesystem->removeDirectory($path); $this->filesystem->removeDirectory($path);