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.
922 B · 39 lines
PHP
12345678910111213141516171819202122232425262728293031323334353637383940<?php
/** * Redirect to the current raw contents of a Paste. * * This controller provides a stable URI for getting the current contents of * a paste, and slightly simplifies the view controller. */final class PhabricatorPasteRawController extends PhabricatorPasteController {
public function shouldAllowPublic() { return true; }
public function handleRequest(AphrontRequest $request) { $viewer = $request->getViewer(); $id = $request->getURIData('id');
$paste = id(new PhabricatorPasteQuery()) ->setViewer($viewer) ->withIDs(array($id)) ->executeOne(); if (!$paste) { return new Aphront404Response(); }
$file = id(new PhabricatorFileQuery()) ->setViewer($viewer) ->withPHIDs(array($paste->getFilePHID())) ->executeOne(); if (!$file) { return new Aphront400Response(); }
return $file->getRedirectResponse(); }
}