@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
at upstream/main 36 lines 843 B view raw
1<?php 2 3final class PhabricatorFileDocumentController 4 extends PhabricatorFileController { 5 6 public function shouldAllowPublic() { 7 return true; 8 } 9 10 public function handleRequest(AphrontRequest $request) { 11 $engine = id(new PhabricatorFileDocumentRenderingEngine()) 12 ->setRequest($request) 13 ->setController($this); 14 15 $viewer = $request->getViewer(); 16 17 $file_phid = $request->getURIData('phid'); 18 19 $file = id(new PhabricatorFileQuery()) 20 ->setViewer($viewer) 21 ->withPHIDs(array($file_phid)) 22 ->executeOne(); 23 if (!$file) { 24 return $engine->newErrorResponse( 25 pht( 26 'This file ("%s") does not exist or could not be loaded.', 27 $file_phid)); 28 } 29 30 $ref = id(new PhabricatorDocumentRef()) 31 ->setFile($file); 32 33 return $engine->newRenderResponse($ref); 34 } 35 36}