1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Differental - match "Revision ID:" uri value on domain only

Summary: pre-patch, we match on things like https / http and port... just match domains. Fixes T5693.

Test Plan: arc diff -> arc land and the diff was closed correctly

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T5693

Differential Revision: https://secure.phabricator.com/D10701
This commit is contained in:
Bob Trahan 2014-10-13 17:08:57 -07:00
parent 1af6f21573
commit af4ebc67c6

View file

@ -47,22 +47,26 @@ final class DifferentialRevisionIDField
$this->revisionID = $value;
}
private static function parseRevisionIDFromURI($uri) {
$path = id(new PhutilURI($uri))->getPath();
private static function parseRevisionIDFromURI($uri_string) {
$uri = new PhutilURI($uri_string);
$path = $uri->getPath();
$matches = null;
if (preg_match('#^/D(\d+)$#', $path, $matches)) {
$id = (int)$matches[1];
$prod_uri = new PhutilURI(PhabricatorEnv::getProductionURI('/D'.$id));
// Make sure the URI is the same as our URI. Basically, we want to ignore
// commits from other Phabricator installs.
if ($uri == PhabricatorEnv::getProductionURI('/D'.$id)) {
if ($uri->getDomain() == $prod_uri->getDomain()) {
return $id;
}
$allowed_uris = PhabricatorEnv::getAllowedURIs('/D'.$id);
foreach ($allowed_uris as $allowed_uri) {
if ($uri == $allowed_uri) {
if ($uri_string == $allowed_uri) {
return $id;
}
}