@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Files - make file info page public

Summary: and for bonus, finesse some URIs a tad. Fixes T5922.

Test Plan: viewed F1 logged out and it worked! viewed the ugly URI for F1 and got redirected to the pretty URI.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5922

Differential Revision: https://secure.phabricator.com/D10309

+21 -31
-2
src/__phutil_library_map__.php
··· 1557 1557 'PhabricatorFileListController' => 'applications/files/controller/PhabricatorFileListController.php', 1558 1558 'PhabricatorFileQuery' => 'applications/files/query/PhabricatorFileQuery.php', 1559 1559 'PhabricatorFileSearchEngine' => 'applications/files/query/PhabricatorFileSearchEngine.php', 1560 - 'PhabricatorFileShortcutController' => 'applications/files/controller/PhabricatorFileShortcutController.php', 1561 1560 'PhabricatorFileStorageBlob' => 'applications/files/storage/PhabricatorFileStorageBlob.php', 1562 1561 'PhabricatorFileStorageConfigurationException' => 'applications/files/exception/PhabricatorFileStorageConfigurationException.php', 1563 1562 'PhabricatorFileStorageEngine' => 'applications/files/engine/PhabricatorFileStorageEngine.php', ··· 4406 4405 'PhabricatorFileListController' => 'PhabricatorFileController', 4407 4406 'PhabricatorFileQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 4408 4407 'PhabricatorFileSearchEngine' => 'PhabricatorApplicationSearchEngine', 4409 - 'PhabricatorFileShortcutController' => 'PhabricatorFileController', 4410 4408 'PhabricatorFileStorageBlob' => 'PhabricatorFileDAO', 4411 4409 'PhabricatorFileStorageConfigurationException' => 'Exception', 4412 4410 'PhabricatorFileTemporaryGarbageCollector' => 'PhabricatorGarbageCollector',
+1 -1
src/applications/files/application/PhabricatorFilesApplication.php
··· 42 42 43 43 public function getRoutes() { 44 44 return array( 45 - '/F(?P<id>[1-9]\d*)' => 'PhabricatorFileShortcutController', 45 + '/F(?P<id>[1-9]\d*)' => 'PhabricatorFileInfoController', 46 46 '/file/' => array( 47 47 '(query/(?P<key>[^/]+)/)?' => 'PhabricatorFileListController', 48 48 'upload/' => 'PhabricatorFileUploadController',
+19 -3
src/applications/files/controller/PhabricatorFileInfoController.php
··· 3 3 final class PhabricatorFileInfoController extends PhabricatorFileController { 4 4 5 5 private $phid; 6 + private $id; 7 + 8 + public function shouldAllowPublic() { 9 + return true; 10 + } 6 11 7 12 public function willProcessRequest(array $data) { 8 - $this->phid = $data['phid']; 13 + $this->phid = idx($data, 'phid'); 14 + $this->id = idx($data, 'id'); 9 15 } 10 16 11 17 public function processRequest() { 12 18 $request = $this->getRequest(); 13 19 $user = $request->getUser(); 14 20 21 + if ($this->phid) { 22 + $file = id(new PhabricatorFileQuery()) 23 + ->setViewer($user) 24 + ->withPHIDs(array($this->phid)) 25 + ->executeOne(); 26 + 27 + if (!$file) { 28 + return new Aphront404Response(); 29 + } 30 + return id(new AphrontRedirectResponse())->setURI($file->getInfoURI()); 31 + } 15 32 $file = id(new PhabricatorFileQuery()) 16 33 ->setViewer($user) 17 - ->withPHIDs(array($this->phid)) 34 + ->withIDs(array($this->id)) 18 35 ->executeOne(); 19 - 20 36 if (!$file) { 21 37 return new Aphront404Response(); 22 38 }
-24
src/applications/files/controller/PhabricatorFileShortcutController.php
··· 1 - <?php 2 - 3 - final class PhabricatorFileShortcutController 4 - extends PhabricatorFileController { 5 - 6 - private $id; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->id = $data['id']; 10 - } 11 - 12 - public function processRequest() { 13 - $file = id(new PhabricatorFileQuery()) 14 - ->setViewer($this->getRequest()->getUser()) 15 - ->withIDs(array($this->id)) 16 - ->executeOne(); 17 - if (!$file) { 18 - return new Aphront404Response(); 19 - } 20 - 21 - return id(new AphrontRedirectResponse())->setURI($file->getInfoURI()); 22 - } 23 - 24 - }
+1 -1
src/applications/files/storage/PhabricatorFile.php
··· 495 495 } 496 496 497 497 public function getInfoURI() { 498 - return '/file/info/'.$this->getPHID().'/'; 498 + return '/'.$this->getMonogram(); 499 499 } 500 500 501 501 public function getBestURI() {