1
0
Fork 0

Fix target-dir with multiple slashes too

pull/1128/head
Jordi Boggiano 2012-09-19 11:25:49 +02:00
parent a9195eb05f
commit 8d7e5cdda5
2 changed files with 4 additions and 1 deletions

View File

@ -118,7 +118,7 @@ class Package extends BasePackage
return; return;
} }
return ltrim(preg_replace('{ (?:^|[\\\\/]) \.\.? (?:[\\\\/]|$) (?:\.\.? (?:[\\\\/]|$) )*}x', '/', $this->targetDir), '/'); return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
} }
/** /**

View File

@ -94,5 +94,8 @@ class CompletePackageTest extends TestCase
$package->setTargetDir('/foo/..'); $package->setTargetDir('/foo/..');
$this->assertEquals('foo/', $package->getTargetDir()); $this->assertEquals('foo/', $package->getTargetDir());
$package->setTargetDir('/foo/..//bar');
$this->assertEquals('foo/bar', $package->getTargetDir());
} }
} }