From af4ebc67c66fb90bc6d73ea42ddb8d2bd7ba9dac Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 13 Oct 2014 17:08:57 -0700 Subject: [PATCH] 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 --- .../customfield/DifferentialRevisionIDField.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialRevisionIDField.php b/src/applications/differential/customfield/DifferentialRevisionIDField.php index 74c38767d9..3741c0126f 100644 --- a/src/applications/differential/customfield/DifferentialRevisionIDField.php +++ b/src/applications/differential/customfield/DifferentialRevisionIDField.php @@ -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; } }