1
0
Fork 0

Only update dist references when one existed already, fixes #6363

pull/6555/merge
Jordi Boggiano 2017-08-06 16:54:17 +02:00
parent 57ed58346a
commit 9afbddab6b
1 changed files with 3 additions and 1 deletions

View File

@ -1187,10 +1187,12 @@ class Installer
}
$package->setSourceReference($reference);
$package->setDistReference($reference);
if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
$package->setDistReference($reference);
$package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
} else if ($package->getDistReference()) { // update the dist reference if there was one, but if none was provided ignore it
$package->setDistReference($reference);
}
}