1
0
Fork 0

Use a saner file name for package archives

pull/1567/head
Nils Adermann 2013-02-07 11:36:49 +01:00
parent bcbc50c0d6
commit 33828b38df
2 changed files with 4 additions and 3 deletions

View File

@ -75,12 +75,13 @@ class ArchiveManager
// Directory used to download the sources // Directory used to download the sources
$filesystem = new Filesystem(); $filesystem = new Filesystem();
$packageName = $package->getUniqueName(); $packageName = preg_replace('#[^a-z0-9-_.]#i', '-', $package->getPrettyString());
$sourcePath = sys_get_temp_dir().'/composer_archiver/'.$packageName; $sourcePath = sys_get_temp_dir().'/composer_archiver/'.$packageName;
$filesystem->ensureDirectoryExists($sourcePath); $filesystem->ensureDirectoryExists($sourcePath);
// Archive filename // Archive filename
$target = $targetDir.'/'.$packageName.'.'.$format; $filesystem->ensureDirectoryExists($targetDir);
$target = realpath($targetDir).'/'.$packageName.'.'.$format;
$filesystem->ensureDirectoryExists(dirname($target)); $filesystem->ensureDirectoryExists(dirname($target));
// Download sources // Download sources

View File

@ -63,7 +63,7 @@ class ArchiveManagerTest extends ArchiverTest
protected function getTargetName(PackageInterface $package, $format) protected function getTargetName(PackageInterface $package, $format)
{ {
$packageName = $package->getUniqueName(); $packageName = preg_replace('#[^a-z0-9-_.]#i', '-', $package->getPrettyString());
$target = $this->targetDir.'/'.$packageName.'.'.$format; $target = $this->targetDir.'/'.$packageName.'.'.$format;
return $target; return $target;