Something went wrong. Try again.
@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
Something went wrong. Try again.
1.1 kB · 45 lines
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546<?php
final class DiffusionDocumentController extends DiffusionController {
public function shouldAllowPublic() { return true; }
public function handleRequest(AphrontRequest $request) { $response = $this->loadDiffusionContext(); if ($response) { return $response; }
$drequest = $this->getDiffusionRequest();
$engine = id(new DiffusionDocumentRenderingEngine()) ->setRequest($request) ->setDiffusionRequest($drequest) ->setController($this);
$viewer = $this->getViewer(); $request = $this->getRequest(); $repository = $drequest->getRepository();
$file_phid = $request->getStr('filePHID');
$file = id(new PhabricatorFileQuery()) ->setViewer($viewer) ->withPHIDs(array($file_phid)) ->executeOne(); if (!$file) { return $engine->newErrorResponse( pht( 'This file ("%s") does not exist or could not be loaded.', $file_phid)); }
$ref = id(new PhabricatorDocumentRef()) ->setFile($file);
return $engine->newRenderResponse($ref); }
}