@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorSystemObjectController
4 extends PhabricatorController {
5
6 public function shouldAllowPublic() {
7 return true;
8 }
9
10 public function handleRequest(AphrontRequest $request) {
11 $viewer = $this->getViewer();
12 $name = $request->getURIData('name');
13
14 $object = id(new PhabricatorObjectQuery())
15 ->setViewer($viewer)
16 ->withNames(array($name))
17 ->executeOne();
18 if (!$object) {
19 return new Aphront404Response();
20 }
21
22 $phid = $object->getPHID();
23 $handles = $viewer->loadHandles(array($phid));
24 $handle = $handles[$phid];
25
26 $object_uri = $handle->getURI();
27 if (!strlen($object_uri)) {
28 return $this->newDialog()
29 ->setTitle(pht('No Object URI'))
30 ->appendParagraph(
31 pht(
32 'Object "%s" exists, but does not have a URI to redirect to.',
33 $name))
34 ->addCancelButton('/', pht('Done'));
35 }
36
37 return id(new AphrontRedirectResponse())->setURI($object_uri);
38 }
39}