diff --git a/src/applications/conduit/method/diffusion/ConduitAPI_diffusion_findsymbols_Method.php b/src/applications/conduit/method/diffusion/ConduitAPI_diffusion_findsymbols_Method.php index 8be4467fec..e818063df8 100644 --- a/src/applications/conduit/method/diffusion/ConduitAPI_diffusion_findsymbols_Method.php +++ b/src/applications/conduit/method/diffusion/ConduitAPI_diffusion_findsymbols_Method.php @@ -70,15 +70,21 @@ final class ConduitAPI_diffusion_findsymbols_Method $results = $query->execute(); + $response = array(); foreach ($results as $result) { + $uri = $result->getURI(); + if ($uri) { + $uri = PhabricatorEnv::getProductionURI($uri); + } + $response[] = array( 'name' => $result->getSymbolName(), 'type' => $result->getSymbolType(), 'language' => $result->getSymbolLanguage(), 'path' => $result->getPath(), 'line' => $result->getLineNumber(), - 'uri' => PhabricatorEnv::getProductionURI($result->getURI()), + 'uri' => $uri, ); } diff --git a/src/applications/repository/storage/PhabricatorRepositorySymbol.php b/src/applications/repository/storage/PhabricatorRepositorySymbol.php index 250a1100cb..12c4726389 100644 --- a/src/applications/repository/storage/PhabricatorRepositorySymbol.php +++ b/src/applications/repository/storage/PhabricatorRepositorySymbol.php @@ -45,6 +45,13 @@ final class PhabricatorRepositorySymbol extends PhabricatorRepositoryDAO { } public function getURI() { + if (!$this->repository) { + // This symbol is in the index, but we don't know which Repository it's + // part of. Usually this means the Arcanist Project hasn't been linked + // to a Repository. We can't generate a URI, so just fail. + return null; + } + $request = DiffusionRequest::newFromDictionary( array( 'repository' => $this->getRepository(), diff --git a/src/infrastructure/daemon/irc/handler/PhabricatorIRCObjectNameHandler.php b/src/infrastructure/daemon/irc/handler/PhabricatorIRCObjectNameHandler.php index 234e837352..5ced711c94 100644 --- a/src/infrastructure/daemon/irc/handler/PhabricatorIRCObjectNameHandler.php +++ b/src/infrastructure/daemon/irc/handler/PhabricatorIRCObjectNameHandler.php @@ -240,16 +240,17 @@ final class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler { 'name' => $symbol, )); + $default_uri = $this->getURI('/diffusion/symbol/'.$symbol.'/'); + if (count($results) > 1) { - $uri = $this->getURI('/diffusion/symbol/'.$symbol.'/'); - $response = "Multiple symbols named '{$symbol}': {$uri}"; + $response = "Multiple symbols named '{$symbol}': {$default_uri}"; } else if (count($results) == 1) { $result = head($results); $response = $result['type'].' '. $result['name'].' '. '('.$result['language'].'): '. - $result['uri']; + nonempty($result['uri'], $default_uri); } else { $response = "No symbol '{$symbol}' found anywhere."; }